1

I have a paper with some elements that the user can drag around and resize. Is there a way to reset these elements info so that subsequent transforms start from that?

If I use transform('T') then changes in position or size are from the beginning of the user session and if I use transform('...T') then it starts from the previous transform. I would like, at certain times to essentially reset the origin so that transform('T') works from these saved states. Hope that makes sense.

hexacyanide
  • 88,222
  • 31
  • 159
  • 162
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
  • I'm not sure if I understand well enough, but would you like to take a look at this discussion? https://groups.google.com/forum/?fromgroups=#!topic/raphaeljs/Dd8hFCbnkwg They mention saving each transform to a stack and popping it off. So maybe you can use the reset function and then restore the previous transformation by popping it off the stack. – tnsingle Feb 19 '13 at 13:20

1 Answers1

0

According to the docs at Raphael use the following:

// to reset transformation call method with empty string
el.transform("");
Neil
  • 7,861
  • 4
  • 53
  • 74
  • That seems to just undo all the transformations previously applied. If I move my element then call this, the element is put back in it's original place rather than staying put and using the new location, size and rotation as the origin for subsequent transforms. – cyberwombat Feb 14 '13 at 16:08
  • 1
    can you set up a jsfiddle so I can fix it for you? – Neil Feb 14 '13 at 17:29
  • Sure - http://jsfiddle.net/cyberwombat/BEydX/1/ - note that I do not want relative transforms nor do I want to perform calculations - it's what I do now and it works - just wondering if there was a one liner that I can put in indicated space in fiddle that will cause the next click to work. – cyberwombat Feb 14 '13 at 22:00
  • 1
    Ok I still don't quite understand what you need here. If you do "...t50,50" that will always transform from current position. Can you add your drag and drop so we can go from there? – Neil Feb 15 '13 at 10:30
  • The real app has many controls and transforms - I do use relative transforms but I have to do all sorts of calculations to figure out the current state (location, rotation and scale) of each element. I don't think there is a way to reset but I thought I would check as it would make my app a lot easier to code. Thanks – cyberwombat Feb 15 '13 at 23:12
  • hi Yashua, have you sorted out this problem? I'm dealing with the same issue. – user1762087 Feb 12 '15 at 14:48