How to scale path in raphael.js

I don’t understand why the following example does not work ... It only works if I resize it once, but if I try to resize it again, it will all go bad ...

http://jsfiddle.net/JAVWN/1/

+7
source share
2 answers

You might think that if you called scale () once and then called scale () again, the results would be cumulative, but that doesn't seem to be the case. It seems that if you call scale (), it remembers the original measurements and scales them, not the previously recalculated measurements.

As I got your example for work, it was to save the scale (one variable for each dimension) on your object (starting with scaleX = scaleY = 1). Then I multiplied the saved scale by the scale calculated from the final position of the corrector / cursor and saved them in your object. Finally, I used saved scales in a call to the scale () function to resize your shapes.

See http://jsfiddle.net/donniec/JAVWN/2/

+8
source

I fixed it ... just use node.resetScale ();

+1
source

All Articles