fix(mobile): preserve zoom level when new images load in asset viewer

This commit is contained in:
LeLunZ 2026-04-19 15:18:16 +02:00
parent 312bb91a4f
commit 276b42d3ff

View File

@ -145,7 +145,15 @@ class _ImageWrapperState extends State<ImageWrapper> {
_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);