From 6653d06f2802fd65c7c644503ffd9cfa79faa41e Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Wed, 17 Apr 2024 11:14:37 -0400 Subject: [PATCH] update viewer defaults --- client/src/components/ThumbnailViewer.vue | 4 ++-- client/src/components/geoJS/geoJSUtils.ts | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/client/src/components/ThumbnailViewer.vue b/client/src/components/ThumbnailViewer.vue index 0904aee..d766862 100644 --- a/client/src/components/ThumbnailViewer.vue +++ b/client/src/components/ThumbnailViewer.vue @@ -235,8 +235,8 @@ export default defineComponent({ position: absolute; top: 50%; left: 50%; - -ms-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); + // -ms-transform: translate(-50%, -50%); + // transform: translate(-50%, -50%); } .geojs-map.annotation-input { cursor: inherit; diff --git a/client/src/components/geoJS/geoJSUtils.ts b/client/src/components/geoJS/geoJSUtils.ts index c799cba..0269de5 100644 --- a/client/src/components/geoJS/geoJSUtils.ts +++ b/client/src/components/geoJS/geoJSUtils.ts @@ -17,6 +17,8 @@ const useGeoJS = () => { right: 1, }; + let originalDimensions = { width: 0, height: 0 }; + const getGeoViewer = () => { return geoViewer; }; @@ -29,6 +31,7 @@ const useGeoJS = () => { ) => { thumbnail.value = thumbanilVal; container.value = sourceContainer; + originalDimensions = {width, height }; const params = geo.util.pixelCoordinateParams(container.value, width, height); if (!container.value) { return; @@ -112,7 +115,7 @@ const useGeoJS = () => { .draw(); } if (resetCam) { - resetMapDimensions(width, height, 0.3,resetCam); + resetMapDimensions(width, height, 0.3, resetCam); } else { const params = geo.util.pixelCoordinateParams(container.value, width, height, width, height); const margin = 0.3; @@ -129,16 +132,21 @@ const useGeoJS = () => { }; const resetZoom = () => { - const { width: mapWidth } = geoViewer.value.camera().viewport; + const { width: mapWidth, } = geoViewer.value.camera().viewport; const bounds = !thumbnail.value ? { - left: -125, // Making sure the legend is on the screen - top: 0, - right: mapWidth, + left: 0, // Making sure the legend is on the screen + top: -(originalBounds.bottom - originalDimensions.height) / 2.0, + right: mapWidth*2, bottom: originalBounds.bottom, } - : originalBounds; + : { + left: 0, + top: 0, + right: originalDimensions.width, + bottom: originalDimensions.height, + }; const zoomAndCenter = geoViewer.value.zoomAndCenterFromBounds(bounds, 0); geoViewer.value.zoom(zoomAndCenter.zoom); geoViewer.value.center(zoomAndCenter.center); @@ -154,13 +162,13 @@ const useGeoJS = () => { }); const params = geo.util.pixelCoordinateParams(container.value, width, height, width, height); const { right, bottom } = params.map.maxBounds; - originalBounds = params.map.maxBounds; geoViewer.value.maxBounds({ left: 0 - right * margin, top: 0 - bottom * margin, right: right * (1 + margin), bottom: bottom * (1 + margin), }); + originalBounds = geoViewer.value.maxBounds(); geoViewer.value.zoomRange({ // do not set a min limit so that bounds clamping determines min min: -Infinity,