Skip to content

Commit

Permalink
fix zoom/pan glitch on plane photos
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tyrasd committed Jun 26, 2024
1 parent 6b0d6f7 commit 21d9971
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions css/60_photos.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down
9 changes: 4 additions & 5 deletions modules/services/plane_photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down

0 comments on commit 21d9971

Please sign in to comment.