svg - Raphael - Transform after Serialization -


i using raphael draw paths. each path has associated rectangle [container] size , position of bounding box. using container dragging both shapes.

in move callback, update both positions both move together.

this works great until serialize. serializing path, creating container on fly after deserialization.

immediately after converting json , back, things fine. can print out current transform of path , looks correct. doing transform on path after results in path being reset , moved 0,0.

here fiddle shows problem.

if move rect, can see both objects move together.

if click 'save/load', things fine, , path prints same.

if drag, path gets reset 0,0. printing shows transform has been reset 0,0.

i trying find out how make path move did before serialization. getting lost in process? or there internal state needs updated?

raphael.json serialises data stored in elements. not preserve temporary data stored in paper object indeed lost in process when calling r.clear(). example drag events bound elements not preserved.

however main issue here drag function, notice how dragging square second time applies transformation top left of paper. suggest using raphael.freetransform (which included in fiddle) handle this.

i wrote both raphael.json , raphael.freetransform plugins , have struggled same issues. i'm working on application lets save save , restore state of paper (similar you're doing) , works fine. if need feel free open issue on github.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -