🛠️ Fix issues with pointerInput

* Fixed issues where pointerInput did not reset dragged composable position
This commit is contained in:
Acclorite 2025-01-15 13:12:24 +02:00
parent 8966951303
commit 181f1c94eb
2 changed files with 2 additions and 0 deletions

View file

@ -113,6 +113,7 @@ fun ModalDrawer(
.pointerInput(Unit) { .pointerInput(Unit) {
detectHorizontalDragGestures( detectHorizontalDragGestures(
onDragStart = { offset.floatValue = 0f }, onDragStart = { offset.floatValue = 0f },
onDragCancel = { offset.floatValue = 0f },
onDragEnd = { onDragEnd = {
if (offset.floatValue.toDp() < (-60).dp) onDismissRequest() if (offset.floatValue.toDp() < (-60).dp) onDismissRequest()
else offset.floatValue = 0f else offset.floatValue = 0f

View file

@ -23,6 +23,7 @@ fun Modifier.readerColorPresetChange(
Modifier.pointerInput(Unit) { Modifier.pointerInput(Unit) {
detectHorizontalDragGestures( detectHorizontalDragGestures(
onDragStart = { offset.floatValue = 0f }, onDragStart = { offset.floatValue = 0f },
onDragCancel = { offset.floatValue = 0f },
onDragEnd = { onDragEnd = {
when { when {
offset.floatValue > 200 -> { offset.floatValue > 200 -> {