Skip to content

Commit c6264da

Browse files
committed
Normalize scroll zoom sensitivity for mouse vs touchpad
1 parent 7070d83 commit c6264da

File tree

1 file changed

+2
-2
lines changed
  • workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/util

1 file changed

+2
-2
lines changed

workflow-trace-viewer/src/jvmMain/kotlin/com/squareup/workflow1/traceviewer/util/SandboxBackground.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public fun SandboxBackground(
4848
val event = awaitPointerEvent()
4949
if (event.type == PointerEventType.Scroll) {
5050
val scrollDelta = event.changes.first().scrollDelta.y
51-
sandboxState.scale = (sandboxState.scale * if (scrollDelta < 0) 1.1f else 0.9f)
52-
.coerceIn(0.1f, 10f)
51+
val factor = 1f + (-scrollDelta * 0.1f)
52+
sandboxState.scale = (sandboxState.scale * factor).coerceIn(0.1f, 10f)
5353
event.changes.forEach { it.consume() }
5454
}
5555
}

0 commit comments

Comments
 (0)