Skip to content

Conversation

@zhizhangchen
Copy link
Contributor

...gorithm to better support sorting among embeded sortables

Use the item with lowest distance bettween the mouse pointer and
each of its borders to rearrange, the direction of which is
determined by the mouse postion relative to the item, with the
exception when the mouse pointer intersects with the item or
distance is zero, in which case mouse moving direction is used.
Also we use this algorithm to rearrange even when currentContainer
is not changed to override the defective rearranging in _mouseDrag

@scottgonzalez
Copy link
Member

Can you provide a demo that shows the improvement?

@zhizhangchen
Copy link
Contributor Author

Following are the problem examples and solutions provided by this PR:

Problem 1: http://jsfiddle.net/Zvvpt/15/

  1. drag the first item and move slowly down, when getting to the bottom of the sortable, the placeholder moves to the top of the sortable
  2. drag the second item and move slowly down, the placeholder doesn't move until the item is dragged out of the sortable, where the placeholder jumps quickly to the bottom of the sortable and then goes to the middle again

Solution: http://jsfiddle.net/kM4dR/2/

Problems 2: http://jsfiddle.net/6bsGx/3/

  1. Click near the bottom of an item and move downwards, notice that the item can't be dragged out of the inner sortable
  2. Click near the top of an item and move upward, notice that the item can't be dragged out of the inner sortable
    Solution: http://jsfiddle.net/6bsGx/6/

Problems 3: http://jsfiddle.net/k4nn3/3/

  1. drag an item down, notice that it's hard to put the item between the two inner sortables. If you clicked the top of an item and drag it down , it can be put between the inner sortables, but you can never make it there when moving upwards.
    Solution: http://jsfiddle.net/k4nn3/5/
… algorithm to better support sorting among nested sortables Use the item which has the least distance bettween the mouse pointer and one of its borders to rearrange, with direction being determined by the nearest border. Also we use this algorithm to rearrange even when currentContainer is not changed to override the defective rearrangment in _mouseDrag
@zhizhangchen
Copy link
Contributor Author

@scottgonzalez
Copy link
Member

Thanks, landed in bae06d2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants