From a74e0dce04ccef581fec638c200110ec64f672ec Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 24 Mar 2026 18:42:44 -0700 Subject: [PATCH] Restore both-edge swipe: left edge = prev page, right edge = next page Swipe direction is determined by which edge the finger started on AND the drag direction matching (right edge + swipe left = next, left edge + swipe right = prev). Both no-op at their respective boundaries. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../engpad/ui/editor/PadCanvasView.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/net/metacircular/engpad/ui/editor/PadCanvasView.kt b/app/src/main/kotlin/net/metacircular/engpad/ui/editor/PadCanvasView.kt index 890b7ea..f0c9fb1 100644 --- a/app/src/main/kotlin/net/metacircular/engpad/ui/editor/PadCanvasView.kt +++ b/app/src/main/kotlin/net/metacircular/engpad/ui/editor/PadCanvasView.kt @@ -794,9 +794,9 @@ class PadCanvasView(context: Context) : View(context) { lastTouchY = event.y fingerDownX = event.x fingerDownY = event.y - // Detect if finger started at screen edge + // Detect if finger started at either screen edge val edgeZone = width * EDGE_ZONE_FRACTION - isEdgeSwipe = event.x > width - edgeZone // Only right edge for next page + isEdgeSwipe = event.x < edgeZone || event.x > width - edgeZone } MotionEvent.ACTION_MOVE -> { if (!scaleGestureDetector.isInProgress && event.pointerCount == 1) { @@ -821,9 +821,15 @@ class PadCanvasView(context: Context) : View(context) { val dy = event.y - fingerDownY val absDx = Math.abs(dx) val absDy = Math.abs(dy) - if (absDx > EDGE_SWIPE_MIN_PX && absDx > absDy * 2 && dx < 0) { - // Swipe left from right edge = next page - onEdgeSwipe?.invoke(SwipeDirection.NEXT) + val edgeZone = width * EDGE_ZONE_FRACTION + if (absDx > EDGE_SWIPE_MIN_PX && absDx > absDy * 2) { + if (fingerDownX > width - edgeZone && dx < 0) { + // Swipe left from right edge = next page + onEdgeSwipe?.invoke(SwipeDirection.NEXT) + } else if (fingerDownX < edgeZone && dx > 0) { + // Swipe right from left edge = prev page + onEdgeSwipe?.invoke(SwipeDirection.PREV) + } } } isEdgeSwipe = false