Skip to content Skip to sidebar Skip to footer

Transforming Mouse Coordinates In Canvas Using Fabric.js

I have designed a ruler using fabric.js and when the user mouses over the specific part of the ruler I want to print to the screen the X-coordinate of the ruler (i.e. not the scree

Solution 1:

Use the getPointer merthod on canvas Instance. In your case it should be canvas.getPointer(options.e)which returns an object with x and y properties which represent pointer coordinates relative to canvas.


Post a Comment for "Transforming Mouse Coordinates In Canvas Using Fabric.js"