ocanvas
ocanvas copied to clipboard
Events misplaced after css rotation of canvas container
If i rotate with css the canvas container the events associated to the objects are fired over a different area, in the test case the event added to the light blue object are fired a few pixels above the red one.
https://gist.github.com/3832805
I consider this an edge case. If you feel strongly about this, please have a look at the source and submit a pull request with the fix. If I should do it, it will be pretty far down on my priority list.
I think i can spend some time on it, any code hint is appreciated :)
Great! You can look in tools.js, in the method transformPointerPosition. That will transform the pointer position in a way so it can be compared to an object in it's normal rotation state (for example a rectangle with rotation: 0 with no parents that are rotated). That method will loop through the whole parent chain of the object, and takes the origin and rotation of the parent objects into consideration. To do this fix, I would guess you have to add the canvas itself as the most outer parent, and detect the rotation and origin through CSS properties instead.