From 276b42d3ff04246a198f9bb7105db7f23fa3f8b2 Mon Sep 17 00:00:00 2001 From: LeLunZ <31982496+LeLunZ@users.noreply.github.com> Date: Sun, 19 Apr 2026 15:18:16 +0200 Subject: [PATCH] fix(mobile): preserve zoom level when new images load in asset viewer --- .../lib/widgets/photo_view/src/photo_view_wrappers.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart b/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart index d8d2ae7ee5..1496ccc3d1 100644 --- a/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart +++ b/mobile/lib/widgets/photo_view/src/photo_view_wrappers.dart @@ -145,7 +145,15 @@ class _ImageWrapperState extends State { _lastStack = null; _didLoadSynchronously = synchronousCall; + final oldBoundaries = widget.controller.scaleBoundaries; widget.controller.scaleBoundaries = scaleBoundaries; + if (oldBoundaries != null) { + final ratio = scaleBoundaries.initialScale / oldBoundaries.initialScale; + final currentScale = widget.controller.scale; + if (currentScale != null) { + widget.controller.setScaleInvisibly(currentScale * ratio); + } + } } synchronousCall && !_didLoadSynchronously ? setupCB() : setState(setupCB);