I don't understand why the following example is not working... It only works if I am resizing it once but if I try to resize it again it get's all messed up...
Asked
Active
Viewed 4,392 times
2 Answers
8
You would think that if you called scale() once and then called scale() again, the results would be cumulative, but this doesn't seem to be the case. It seems that if you call scale(), it remembers the original dimensions and scales those rather than the previously recalculated dimensions.
The way I got your example to work was to store the scale (one variable for each dimension) on your object (starting with scaleX = scaleY = 1). Then I multiplied the stored scale by the scale calculated from the final position of the resizer/cursor and stored those in your object. Finally, I used the stored scales in the scale() function call to resize your shapes.

Donnie C
- 659
- 1
- 6
- 9
-
Nice one :) That's why I love stackoverflow – thgie May 05 '11 at 07:43
1
I fixed it... just use node.resetScale();

fogy
- 81
- 1
- 4
-
That method name seems counter-intuitive, but I'm glad it works. Wish I had found it in the Raphael documentation. – Donnie C May 05 '11 at 17:39