You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before I started using your VueDrawingCanvas I tried to create my own canvas and got it working, but couldn't get touch to work and I had encountered this offset problem too.
I had this issue because I used the mouse position to draw instead of the position of the mouse relative to the canvas element...
I accomplished it by creating this code, as you can see I use mouseCanvasX and Y instead of e.clientX directly:
Before I started using your VueDrawingCanvas I tried to create my own canvas and got it working, but couldn't get touch to work and I had encountered this offset problem too.
I had this issue because I used the mouse position to draw instead of the position of the mouse relative to the canvas element...
I accomplished it by creating this code, as you can see I use mouseCanvasX and Y instead of e.clientX directly:
`
const draw = (e) => {
const rect = canvas.getBoundingClientRect();
let mouseCanvasX = (e.clientX - rect.left) / (rect.right - rect.left) * canvas.width;
let mouseCanvasY = (e.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height;
`
The text was updated successfully, but these errors were encountered: