This commit is contained in:
Ilya Kantor 2019-05-17 20:26:14 +03:00
parent 809cebcd04
commit ee4a91e56c

View file

@ -101,7 +101,7 @@ ball.style.left = pageX - ball.offsetWidth / 2 + 'px';
ball.style.top = pageY - ball.offsetHeight / 2 + 'px'; ball.style.top = pageY - ball.offsetHeight / 2 + 'px';
``` ```
Not bad, but there's a side-effect. To initiate the drag'n'drop can we `mousedown` anywhere on the ball. If do it at the edge, then the ball suddenly "jumps" to become centered. Not bad, but there's a side-effect. To initiate the drag'n'drop, we can `mousedown` anywhere on the ball. But if do it at the edge, then the ball suddenly "jumps" to become centered.
It would be better if we keep the initial shift of the element relative to the pointer. It would be better if we keep the initial shift of the element relative to the pointer.