Drawing a rectangle using click, mouse move, and click

前端 未结 4 530
滥情空心
滥情空心 2020-11-30 08:59

I\'m trying to draw a rectangle by a user click, mouse move, and click. There are two problems with my code.

Firstly, after one rectangle is drawn it is automaticall

4条回答
  •  忘掉有多难
    2020-11-30 09:23

    For those who encountered the scrolling problem, I've found a fix.
    You need to get the offset (using window.pageYOffset) and reduce it from the mouse position in any of the recommended snippets given. You should take it off from the height as well.

提交回复
热议问题