Skip to content

Commit

Permalink
only swap with items in view
Browse files Browse the repository at this point in the history
  • Loading branch information
Calvin-LL committed Dec 3, 2023
1 parent 93fa0c9 commit bcea1f8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class ReorderableLazyListState internal constructor(
if (!programmaticScroller.isScrolling) {
// find a target item to swap with
val targetItem = state.layoutInfo.visibleItemsInfo.find { item ->
item.offsetMiddle in startOffset..endOffset && draggingItem.index != item.index && item.key in reorderableKeys
item.offsetMiddle in startOffset..endOffset && draggingItem.index != item.index && item.key in reorderableKeys && item.offset >= contentStartOffset && item.offset + item.size <= contentEndOffset
}
if (targetItem != null) {
swapItems(draggingItem, targetItem)
Expand Down

0 comments on commit bcea1f8

Please sign in to comment.