mcm-ham / dragsort

jQuery List DragSort
3 stars 1 forks source link

Position of "placeholder" based on mouse cursor location, instead of LI box #7

Open mcm-ham opened 6 years ago

mcm-ham commented 6 years ago

Using the attached example, click the dots on list item #4 and drag upwards.   Notice how the placeholder only moves once the user's mouse is over the location of items 3, 2 & 1, even though the top of item #4 is already sitting over them.

Attachments

dragsort-0.4.3_test-pos.zip

This work item was migrated from CodePlex

CodePlex work item ID: '31291' Vote count: '1'

mcm-ham commented 6 years ago

[mcm_ham@25/02/2012] The problem is when it's a 2D list like the one example.html which item do you swap with if your dragged item covers multiple items? It's already coded to only swap with items above it if you're dragged upwards and you could code it to pick the item that is vertically above the mouse when it covers multiple items upwards. But if you drag diagonally up and right it would still match both the item to the right and the item above it at the same time with those rules, which would result in continual swapping.

In your example I would set dragBetween to true so it's not bounded by the UL then it wouldn't feel so unnatural when you're dragging the big item to the top and the placeholder is swapping with items above yet the dragged item is still.

mcm-ham commented 6 years ago

[Invader_Zim@23/04/2012] Fair enough. The effect we were hoping to achieve was that the dragged item itself defined when the items were swapped, instead of the position of the mouse cursor. This would give the dragged item a more "solid" feel. You could avoid continual swapping by only swapping once a 50% threshold had been passed, where more than 50% of the dragged item was positioned over the item to be swapped.