+ 1

Paint-like program in Javascript problem

Hi, I'm developing a paint-like program in javascript and I have a problem. When the user trigger the mousedown event on the canvas,and then move the mouse, it will be created rects on the mouse position. But if a move more quickly the mouse, there a strange interval in creating the rects. Maybe viewing the code and the final result you will understand https://code.sololearn.com/WOR7EpHbYw7H/#html

27th Jul 2018, 7:22 PM
Michele di Biase
Michele di Biase - avatar
2 Respuestas
+ 4
Try to replace clientX and clientY with offsetX and offsetY clientX is the offset from the client window. offsetX is the offset from the parent element which is the canvas
27th Jul 2018, 10:09 PM
Toni Isotalo
Toni Isotalo - avatar
0
I've tried, but it doesn't work yet
28th Jul 2018, 8:10 AM
Michele di Biase
Michele di Biase - avatar