mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
fix: prevent double-swap ping-pong during relay drag
After swapping with an adjacent item, the dragOffset adjustment can flip its sign (e.g. negative becomes positive), which immediately triggers the second if-block to swap back in the opposite direction within the same onDrag call. This causes the dragged item to jump and the user to end up dragging a different item. Fix by returning after each successful swap so only one swap occurs per drag event. https://claude.ai/code/session_01RVM5kEJGrCaJTaP3GmVHDd
This commit is contained in:
+2
@@ -71,6 +71,7 @@ class RelayDragState(
|
||||
|
||||
dragOffset += aboveHeight
|
||||
draggedItemIndex = currentIndex - 1
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +88,7 @@ class RelayDragState(
|
||||
|
||||
dragOffset -= belowHeight
|
||||
draggedItemIndex = currentIndex + 1
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user