Reset conversion after drawing. Mouse events are also converted when applied to the canvas context, so using transforms only when the drawing can solve this problem. However, this also requires the code to use absolute values, for example:
function draw(){ var im_width = parseInt( imageObj.width + resizeAmount, 10 ); var im_height = parseInt( imageObj.height + resizeAmount, 10 ); var rotationAmount = rotationVal;
Modified violin
Optionally, you will need to use the inverse matrix. This is something that will become available later, when we can select the SVGMatrix based on the current transformation matrix, but currently it is not widely available. Otherwise, the inverse matrix will be applied to the x / y position of the mouse for sorting, as the name implies, to invert the effect of the main transformation.
Optionally use a custom matrix conversion tracking solution (I will invite you to see my own approach to this here , it's free).
PS: the image loading problem was also fixed (see the violin).
user1693593
source share