Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
aclassen committed Nov 13, 2022
1 parent 28ed78f commit 065b81f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion reorderable/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "org.burnoutcrew.composereorderable"
version = "0.9.5"
version = "0.9.6"

kotlin {
jvm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,15 @@ abstract class ReorderableState<T>(
.distinctUntilChanged { old, new -> old.firstOrNull()?.itemIndex == new.firstOrNull()?.itemIndex && old.count() == new.count() }

internal open fun onDragStart(offsetX: Int, offsetY: Int): Boolean {
val x = if (!isVerticalScroll) offsetX + viewportStartOffset else offsetX
val y = if (isVerticalScroll) offsetY + viewportStartOffset else offsetY
val x: Int
val y: Int
if (isVerticalScroll) {
x = offsetX
y = offsetY + viewportStartOffset
} else {
x = offsetX + viewportStartOffset
y = offsetY
}
return visibleItemsInfo
.firstOrNull { x in it.left..it.right && y in it.top..it.bottom }
?.also {
Expand Down Expand Up @@ -205,7 +212,11 @@ abstract class ReorderableState<T>(
) {
return@fastForEach
}
if (canDragOver?.invoke(ItemPosition(item.itemIndex, item.itemKey), ItemPosition(selected.itemIndex, selected.itemKey)) != false) {
if (canDragOver?.invoke(
ItemPosition(item.itemIndex, item.itemKey),
ItemPosition(selected.itemIndex, selected.itemKey)
) != false
) {
val dx = (centerX - (item.left + item.right) / 2).absoluteValue
val dy = (centerY - (item.top + item.bottom) / 2).absoluteValue
val dist = dx * dx + dy * dy
Expand Down

0 comments on commit 065b81f

Please sign in to comment.