dnd-kit
dnd-kit copied to clipboard
[Sortable] Swapping strategy always swaps with the initial position
First of all, many thanks for the great library. Most possibilities are already covered. However there's still a situation I can't get my head around. Let me try to explain.
The current swapping strategy always swaps with the initial position (the position where dragging started). I was wondering if it's possible to swap with the current position?
So imagine I have the following situation:
A B C
D E F
G
In the current situation, if I drag A to G the result will be:
G B C
D E F
A
But what I am looking for is that the result becomes:
D B C
G E F
A
Is this possible with the current swapping strategy?
Have you tried updating the order of the items in onDragOver
?
Sorry for my late reply. I was on a holiday. I'd forgotten to mention the example I was talking about. I'ts the Sortable -> Grid -> Swappable example.
https://5fc05e08a4a65d0021ae0bf2-ipdskkittb.chromatic.com/?path=/story/presets-sortable-grid--swappable