AliasIO / Raphael.FreeTransform

Free transform tool for Raphaël elements.
http://elbertf.com
362 stars 107 forks source link

Rotate issue if origin of paper is not (0,0) #125

Open neilyoung opened 10 years ago

neilyoung commented 10 years ago

Hi,

I'm using your fine component with great success. Now I need to origin the paper on another point, not at (0,0).

There is an issue with the rotation behavior of an object, if the paper is not originated at (0,0).

Here is your sample code with one change: I'm forced to NOT allow handles for rotation, so the FreeTransform is setup like this:

ft = paper.freeTransform(rect, { keepRatio: true, rotate:['self']}, function(ft, events) {
    console.log(ft.attrs);
});

This works fine with your sample as shown here:

http://maps.alphadex.de/ra/sample.html

You can touch the object and rotate it.

Now I'm just instantiating the paper at a different left offset:

var paper = Raphael(400, 0, 500, 500);

The result is shown here:

http://maps.alphadex.de/ra/fail.html

Please not the horrible rotate behavior. BTW: It rotates fine, even if relocated, if I rotate using the handles, but this is no option in my case, unfortunately. It does also not rotate correctly, if the top offset is other than 0, either alone or together with a >0 left offset.

Any pointer welcome. Regards