kutlugsahin / smooth-dnd

drag and drop library for javascript
MIT License
599 stars 147 forks source link

Draggable element is always dragged from center, not mouse coordinates #48

Closed johannes-z closed 5 years ago

johannes-z commented 5 years ago

When you drag and drop an element, it always uses its center as its origin, rather than the mouse coordinates of the mousedown event.

kutlugsahin commented 5 years ago

Yes that's right. Center point of the element is used for collusion detection which make it feel more natural and physical. But I have a plan to provide an api to change that to mouse position or to adjust it to the needs.

johannes-z commented 5 years ago

@kutlugsahin I agree with what you said, just a quick info why this is needed: If you drag a bigger element into i.e. a column that's smaller, you'd have to drag it off-screen for it to snap, as shown in this paint masterpiece:

image