SortableJS / ngx-sortablejs

Angular 2+ binding to SortableJS. Previously known as angular-sortablejs
https://sortablejs.github.io/ngx-sortablejs/
MIT License
466 stars 160 forks source link

Multi Drag odd behavior only with ngx-sortablejs #186

Open h5aaimtron opened 4 years ago

h5aaimtron commented 4 years ago

So I mounted the MultiDrag plugin successfully and in general the functions are working, however; I've come up with a peculiar bug that I can't seem to nail down. If you have 10 items and you select 9, 7, and 6 in that order then drag them to the beginning of the list, starting your drag with 9 element, 6 and 7 go to the beginning, but 9 gets pushed 2 spots down from 7. So 6 is index 0, 7 is index 1, and 9 is index 4. If I make the same selection but start my drag from 7, 6 is index 0, 9 is index 1, and 7 is index 3. Finally, with the same selection, if I start my drag on element 6, all elements go to their proper indexes of 0, 1, 2.

The noted pattern here is that the single element out of place is always out of place by the index its supposed to be at * 2 + the index of the last element's index. This is the weirdest behavior I've seen and I'm not sure why its doing it. I could not reproduce using just SortableJS + MultiDrag, only with through ngx-sortablejs. I did a quick glance at the code and don't see anything obvious. My assumption is that the issue is likely in the bindings, but not 100% sure.

cedececa commented 3 years ago

Hi, how did you mount it?