From ab2985d98544375decf8e6a1fd993b9640db1db7 Mon Sep 17 00:00:00 2001 From: Noenandre <5470915+noenandre@users.noreply.github.com> Date: Fri, 3 Mar 2023 12:36:29 +0100 Subject: [PATCH] Fix zoom for plane photos. TODO: set translateExtent correctly. --- css/60_photos.css | 2 +- modules/services/plane_photo.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/css/60_photos.css b/css/60_photos.css index 96ce413a2..b359bc30b 100644 --- a/css/60_photos.css +++ b/css/60_photos.css @@ -355,7 +355,7 @@ label.streetside-hires { } .kartaview-image-wrap, -.vegbilder-image-wrap { +.plane-photo { width: 100%; height: 100%; transform-origin:0 0; diff --git a/modules/services/plane_photo.js b/modules/services/plane_photo.js index 275a011d9..9449926ec 100644 --- a/modules/services/plane_photo.js +++ b/modules/services/plane_photo.js @@ -1,5 +1,5 @@ import { dispatch as d3_dispatch } from 'd3-dispatch'; -import { zoom as d3_zoom } from 'd3-zoom'; +import { zoom as d3_zoom, zoomIdentity as d3_zoomIdentity } from 'd3-zoom'; import { utilSetTransform, utilRebind } from '../util'; const dispatch = d3_dispatch('viewerChanged'); @@ -57,6 +57,7 @@ export default { return this; }, + hidePhotoFrame: function (context) { context .select('photo-frame.plane-frame') @@ -65,8 +66,11 @@ export default { return this; }, - selectPhoto: function (data) { + selectPhoto: function (data, keepOrientation) { _photo.attr('src', data.image_path); + if (!keepOrientation) { + _photo.call(imgZoom.transform, d3_zoomIdentity); + } return this; },