SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.29k stars 3.69k forks source link

MultiDrag with Grid indices bug #1747

Open h5aaimtron opened 4 years ago

h5aaimtron commented 4 years ago

Problem:

If you use MultiDrag with a grid layout of the items and you select non-consecutive items, but drag from the last item to the beginning of the list, the last item always gets placed a few items away from the other items.

JSBin/JSFiddle demonstrating the problem:

Don't have one yet


Before you create an issue, check it:

  1. Try master-branch, perhaps the problem has been solved;
  2. Use the search, maybe we already have an answer;
  3. If not found, create an example on jsbin.com (draft) and describe the problem.

Bindings:

Support screenshots: image

I selected in the following order: 9, 7, 6 then I start my drag from 9 to the beginning of the list with the following result: image

but 9 should be directly behind 7. It works perfectly if I drag from item 6 to the beginning though.

h5aaimtron commented 4 years ago

I did some more tests and its any item other than the one with the lowest index that gets the weird index. I tried sorting 3, 5, 7, 8, and 10 which resulted in 10 being the odd one out by the number of items ahead of it so its 4 back from the first 4.

owen-m1 commented 4 years ago

A JSBin would be very helpful