Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8162665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:47:48+00:00 2026-06-06T18:47:48+00:00

I am using Raphael to draw some paths. Each path has an associated rectangle

  • 0

I am using Raphael to draw some paths. Each path has an associated rectangle [container] the size and position of the bounding box. I am using the container for dragging both shapes.

In the move callback, I update the both positions so they both move together.

This all works great until I serialize. I am only serializing the path, then creating the container on the fly after deserialization.

Immediately after converting to json and back, things look fine. I can print out the current transform of the path and it looks correct. Doing any transform on the path after this results in the path being reset and moved to 0,0.

Here is a fiddle that shows the problem.

If you move the rect, you can see both objects move together.

If you click ‘Save/Load’, things look fine, and the path prints the same.

If you now drag, the path gets reset to 0,0. Printing shows the transform has been reset from 0,0.

I am trying to find out how to make the path move as it did before serialization. Is something getting lost in the process? Or is there an internal state that needs to be updated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:47:50+00:00Added an answer on June 6, 2026 at 6:47 pm

    Raphael.JSON serialises data stored in the elements. It does not preserve temporary data stored in the paper object so something does indeed get lost in the process when calling R.clear(). For example drag events bound to elements are not preserved.

    However the main issue here is with your drag function, notice how dragging the square a second time applies the transformation from the top left of the paper. I suggest using Raphael.FreeTransform (which you already included in the Fiddle) to handle this.

    I wrote both Raphael.JSON and Raphael.FreeTransform plugins and have struggled with the same issues. I’m currently working on an application that lets you save save and restore the state of the paper (similar to what you’re doing) and it works fine. If you need any help feel free to open an issue on Github.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Raphael library to draw some shapes, and then animate them into
I am using Raphael's JavaScript library (http://raphaeljs.com/) to draw some graphics into my web-application.
I have a script that has a few timeouts, draws a menu using Raphael
I am using the the Joe's Design's Raphael JS tutorial to build some overlaid
I'm using Raphaël.js to draw some small circles (2-4px radius), which is done through
Using the example from How to achieve donut holes with paths in raphael (
I am building a line graph application using Raphael.js and need to draw a
I'm using the raphael javascript library, and I'd like to draw a straight line
I am using Raphael-js to position text on a canvas. Is it possible to
I need to draw concentric arcs of various sizes using raphael.js. I tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.