Tuesday, June 18, 2019

The offset seems to be what I need in the HTML5 draggable API.

Instead of screenX, screenY, clientX, and clientY as suggested here, offsetX and offsetY will tell you how deep you are in the object in startDrag and how far you moved in endDrag. Moving up or left gets denoted by a negative number. This can be superior to simple X and Y values for where you are in the browser at both events and especially so if the items to be drug sit inside something scrollable. You can probably just use the endDrag value in lieu of some sort of mathematic calculation with startDrag and endDrag settings to figure out what's what.

No comments:

Post a Comment