mcFrax / omicron-dnd

Fast JavaScript drag-and-drop library for desktop and mobile browsers.
MIT License
4 stars 0 forks source link

Items often swap in counterintuitive ways #6

Open mcFrax opened 2 years ago

mcFrax commented 2 years ago

There should be a stronger connection between where the pointer is and where the placeholder shows. The current element positions shouldn'r really be an input - or at least, their role should be diminished.

mcFrax commented 2 years ago

Important note: while for most positions on the list the approach "position the item so that it's under the pointer or as close to it as possible" should work just fine, there is a caveat at the end of the list - inserting the element at the end of the list shouldn't require to hit exactly the margin of the container below the last item inside, but should also work over some significant portion of the last item (if any is there). There should probably be a fixed limit of how big that margin is, perhaps linked with placeholderHeight when it's sensible (it may be set to 0!) - so perhaps something like min(0.5*lastItemHeight, max(15, 0.6*placeholderHeight)).

mcFrax commented 2 years ago

So I expect the drop zones for different positions would look something like this: image

but we might also want to ease the difference somewhat, and push the zone for inserting before last item a bit further up into the zone for inserting before last-but-1 item: image