From f2f11b19246125412aced1c36f2eb18ce54dd94a Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 28 Jan 2026 23:03:11 +0100 Subject: [PATCH] fix(mobile): tall image scrolling (#25649) Add cross-axis gesture detection in PhotoView so vertical scrolling works on tall images that don't fill the screen width (have black bars) --- .../src/core/photo_view_gesture_detector.dart | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart b/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart index 7a5406c675..0d2f6fa457 100644 --- a/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart +++ b/mobile/lib/widgets/photo_view/src/core/photo_view_gesture_detector.dart @@ -203,9 +203,13 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer { void _decideIfWeAcceptEvent(PointerEvent event) { final move = _initialFocalPoint! - _currentFocalPoint!; - final bool shouldMove = validateAxis == Axis.vertical - ? hitDetector!.shouldMove(move, Axis.vertical) - : hitDetector!.shouldMove(move, Axis.horizontal); + + // Accept gesture if movement is possible in the direction the user is swiping + final bool isHorizontalGesture = move.dx.abs() > move.dy.abs(); + final bool shouldMove = isHorizontalGesture + ? hitDetector!.shouldMove(move, Axis.horizontal) + : hitDetector!.shouldMove(move, Axis.vertical); + if (shouldMove || _pointerLocations.keys.length > 1) { final double spanDelta = (_currentSpan! - _initialSpan!).abs(); final double focalPointDelta = (_currentFocalPoint! - _initialFocalPoint!).distance;