fix: simplify drag-and-drop logic in ListsScreen and ManageColumnsDialog for reordering items
This commit is contained in:
+1
-3
@@ -2515,9 +2515,7 @@ fun ManageColumnsDialog(
|
|||||||
) {
|
) {
|
||||||
if (from == to) return
|
if (from == to) return
|
||||||
if (isEmpty() || from !in indices) return
|
if (isEmpty() || from !in indices) return
|
||||||
val item = removeAt(from)
|
add(to.coerceIn(0, size), removeAt(from))
|
||||||
val insertIndex = (if (to > from) to - 1 else to).coerceIn(0, size)
|
|
||||||
add(insertIndex, item)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val reorderState =
|
val reorderState =
|
||||||
|
|||||||
@@ -161,10 +161,7 @@ fun ListsScreen(
|
|||||||
) {
|
) {
|
||||||
if (from == to) return
|
if (from == to) return
|
||||||
if (isEmpty() || from !in indices) return
|
if (isEmpty() || from !in indices) return
|
||||||
val item = removeAt(from)
|
add(to.coerceIn(0, size), removeAt(from))
|
||||||
// When moving downwards, the target index shifts left by one after removal
|
|
||||||
val insertIndex = (if (to > from) to - 1 else to).coerceIn(0, size)
|
|
||||||
add(insertIndex, item)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val reorderState =
|
val reorderState =
|
||||||
|
|||||||
Reference in New Issue
Block a user