+ 2

What's wrong with this canvas code? Help Me PlEaSe

I wrote a simple code for dragging squares around the canvas: https://code.sololearn.com/WdtdAHJCBEav/?ref=app It works, I can drag squares, but there are very frequent misstouches. I mean, when i check the coordinates of user touch in "touchstart" for matching square coordinates, the condition returns false, even if the touch matches square . Please help

25th Mar 2022, 5:21 AM
C O F F E E ✹
C O F F E E ✹ - avatar
1 Answer
+ 1
Edited lines :- line 53: -30 line 54: -30 line 55: -30 line 56: -30 line 63: if(e.cancelable) e.preventDefault(); line 73: if(e.cancelable) e.preventDefault(); https://code.sololearn.com/WZJC9mKmTngq/?ref=app
25th Mar 2022, 5:42 AM
Person
Person - avatar