From 21d99715a7ccbaeb7796f2ef0b118157fac4d76c Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 26 Jun 2024 13:12:26 +0200 Subject: [PATCH] fix zoom/pan glitch on plane photos When changing to a different photo, it can be the case that the new photo has a different aspect ratio: the zoom behaviour needs to be updated. Also, keeping the "orientation" does not make sense for plane photos, and even keeping the previously shown photo's zoom is also not typically desired for these. --- css/60_photos.css | 7 +++---- modules/services/plane_photo.js | 9 ++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/css/60_photos.css b/css/60_photos.css index ea5692bdce..1ba524771e 100644 --- a/css/60_photos.css +++ b/css/60_photos.css @@ -475,11 +475,10 @@ label.streetside-hires { transform-origin: 0 0; } -.photoviewer .plane-frame > img.plane-photo{ - width: 100%; +.photoviewer .plane-frame > img.plane-photo { + width: auto; height: 100%; - object-fit: cover; - overflow: hidden; + transform-origin: 0 0; } /* photo-controls (step forward, back, rotate) */ diff --git a/modules/services/plane_photo.js b/modules/services/plane_photo.js index 980d01c22c..938bf87505 100644 --- a/modules/services/plane_photo.js +++ b/modules/services/plane_photo.js @@ -87,14 +87,13 @@ export default { selectPhoto: function (data, keepOrientation) { dispatch.call('viewerChanged'); + loadImage(_photo, ''); loadImage(_photo, data.image_path) .then(() => { - if (!keepOrientation) { - imgZoom = zoomBeahvior(); - _wrapper.call(imgZoom); - _wrapper.call(imgZoom.transform, d3_zoomIdentity.translate(-_widthOverflow / 2, 0)); - } + imgZoom = zoomBeahvior(); + _wrapper.call(imgZoom); + _wrapper.call(imgZoom.transform, d3_zoomIdentity.translate(-_widthOverflow / 2, 0)); }); return this; },