Open silllli opened 8 years ago
The problem lies in how we rebuild the grid when we can't reposition the items underneath the dragged item. What happens is the following:
0
over 2
.0
current spot and place it on the new position.empty spot | 1 | 0, 2 | 3, | 4 | etc
0
collides with 2
and try to move 2
around.2
around it collides with 1
or 3
.1 | 0 | 2 | 3 | 4 | etc
. <- when 2 items have the same positions we order them by their index.0
in the desired position (x = 2, y = 0
).1
.x = 0, y = 0
.2
.1
and we decide it should sit after it.0
and we decide it should sit after it. <- because 0
comes before 2
in the list.x = 3, y = 0
.x = 3
.1 | empty spot | 0 | 2 | 3 | 4 | etc
.1 | 0 | 2 | 3 | 4 | etc
.There's no easy fix for this without redoing our positioning algorithm.
/cc @ovidiu-chereches-hs
I see. Thank you for pointing it out!
When there is only one lane in the grid, finding a new position for items is triggered too late when using the jQuery plugin. It works fine with the first item next to the one that is dragged, but the second already has a wrong "trigger point" - it looks like the dimensions of the item underneath the dragged one are calculated incorrectly (one cell falsely added).
This only happens when moving an item left to right (horizontal grid) or top to bottom (vertical grid) and not in the other direction.
Here you can see the behavior (please ignore the strange image jumping in the beginning):