Skip to content

Commit 065b81f

Browse files
committed
Version bump
1 parent 28ed78f commit 065b81f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

reorderable/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = "org.burnoutcrew.composereorderable"
11-
version = "0.9.5"
11+
version = "0.9.6"
1212

1313
kotlin {
1414
jvm()

reorderable/src/commonMain/kotlin/org/burnoutcrew/reorderable/ReorderableState.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,15 @@ abstract class ReorderableState<T>(
9191
.distinctUntilChanged { old, new -> old.firstOrNull()?.itemIndex == new.firstOrNull()?.itemIndex && old.count() == new.count() }
9292

9393
internal open fun onDragStart(offsetX: Int, offsetY: Int): Boolean {
94-
val x = if (!isVerticalScroll) offsetX + viewportStartOffset else offsetX
95-
val y = if (isVerticalScroll) offsetY + viewportStartOffset else offsetY
94+
val x: Int
95+
val y: Int
96+
if (isVerticalScroll) {
97+
x = offsetX
98+
y = offsetY + viewportStartOffset
99+
} else {
100+
x = offsetX + viewportStartOffset
101+
y = offsetY
102+
}
96103
return visibleItemsInfo
97104
.firstOrNull { x in it.left..it.right && y in it.top..it.bottom }
98105
?.also {
@@ -205,7 +212,11 @@ abstract class ReorderableState<T>(
205212
) {
206213
return@fastForEach
207214
}
208-
if (canDragOver?.invoke(ItemPosition(item.itemIndex, item.itemKey), ItemPosition(selected.itemIndex, selected.itemKey)) != false) {
215+
if (canDragOver?.invoke(
216+
ItemPosition(item.itemIndex, item.itemKey),
217+
ItemPosition(selected.itemIndex, selected.itemKey)
218+
) != false
219+
) {
209220
val dx = (centerX - (item.left + item.right) / 2).absoluteValue
210221
val dy = (centerY - (item.top + item.bottom) / 2).absoluteValue
211222
val dist = dx * dx + dy * dy

0 commit comments

Comments
 (0)