federico-moretti / canvas-free-drawing

A JavaScript library that allows you to draw in a canvas HTML element, straightforward to use and extremely lightweight.
https://www.federicomoretti.dev/projects/canvas-free-drawing
MIT License
65 stars 11 forks source link

Positioned elements causes issues #7

Closed cttobin closed 4 years ago

cttobin commented 4 years ago

Nice little library you have here. I have no idea if you're still maintaining it, but relative/absolute/fixed positioned elements cause mouse events to have the wrong coordinates. See here for an example.

I think it might be related to how you use pageX and pageY with offsetLeft and offsetTop in the mouse events.

federico-moretti commented 4 years ago

I'll try to fix it in the next few days, thanks for the report! Also thank you for using it and the compliments!

jordoreed commented 4 years ago

@federico-moretti love this simple library. do you have any plans to push this fix out to npm anytime soon? if not i can just pull the repo directly. thanks!

federico-moretti commented 4 years ago

Fixed in v2.1.0

jordoreed commented 4 years ago

@federico-moretti thanks! :)