From 59d8861d13a07520aca8bb6a427528ace8787ad8 Mon Sep 17 00:00:00 2001 From: ulite-Amr <48989143+ulite-Amr@users.noreply.github.com> Date: Sun, 30 Aug 2026 17:33:46 +0000 Subject: [PATCH] fix(terminal): require touch slop before starting finger scroll --- .../src/main/kotlin/com/klyx/terminal/ui/Terminal.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/terminal/src/main/kotlin/com/klyx/terminal/ui/Terminal.kt b/terminal/src/main/kotlin/com/klyx/terminal/ui/Terminal.kt index 2e50412c..5cf0c848 100644 --- a/terminal/src/main/kotlin/com/klyx/terminal/ui/Terminal.kt +++ b/terminal/src/main/kotlin/com/klyx/terminal/ui/Terminal.kt @@ -539,19 +539,20 @@ private fun Modifier.scroll( state.scrolledWithFinger.value = true var previousPosition = down.position + var passedTouchSlop = false do { val event = awaitPointerEvent() val dragEvent = event.changes.firstOrNull { it.id == down.id } ?: break if (!dragEvent.pressed) break - val dragAmount = dragEvent.position - previousPosition - previousPosition = dragEvent.position - if (selectionState.isActive) { // Handles own their own drag; nothing to do here for plain scroll. // Edge-auto-scroll is handled inside each handle's onDragPosition. - } else { + previousPosition = dragEvent.position + } else if (passedTouchSlop) { + val dragAmount = dragEvent.position - previousPosition + previousPosition = dragEvent.position dragEvent.consume() state.scrolledWithFinger.value = true @@ -566,6 +567,9 @@ private fun Modifier.scroll( fontMetrics ) } + } else if ((dragEvent.position - down.position).getDistance() > viewConfiguration.touchSlop) { + passedTouchSlop = true + previousPosition = dragEvent.position } } while (true)