From ced7b880540b612eac25b318f3aac4ddbb4e8407 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 13 Dec 2024 13:15:01 +0100 Subject: [PATCH] fix: submap - generate in current canvas size --- index.css | 1 + index.html | 8 ++++---- modules/ui/options.js | 12 ++++++------ modules/ui/submap-tool.js | 2 ++ modules/ui/transform-tool.js | 3 +++ versioning.js | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/index.css b/index.css index 0244eb23..fd8e8f1e 100644 --- a/index.css +++ b/index.css @@ -240,6 +240,7 @@ t, #routes { fill: none; cursor: pointer; + mask: url(#land); } i.icon-lock { diff --git a/index.html b/index.html index 02dc06f9..c65c7cc3 100644 --- a/index.html +++ b/index.html @@ -138,7 +138,7 @@ } - + @@ -8092,7 +8092,7 @@ - + @@ -8133,8 +8133,8 @@ - - + + diff --git a/modules/ui/options.js b/modules/ui/options.js index bd8d8b0f..537a6a4e 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -210,16 +210,16 @@ function fitMapToScreen() { svgHeight = Math.min(+mapHeightInput.value, window.innerHeight); svg.attr("width", svgWidth).attr("height", svgHeight); - const zoomExtent = [ - [0, 0], - [graphWidth, graphHeight] - ]; - const zoomMin = rn(Math.max(svgWidth / graphWidth, svgHeight / graphHeight), 3); zoomExtentMin.value = zoomMin; const zoomMax = +zoomExtentMax.value; - zoom.translateExtent(zoomExtent).scaleExtent([zoomMin, zoomMax]).scaleTo(svg, zoomMin); + zoom + .translateExtent([ + [0, 0], + [graphWidth, graphHeight] + ]) + .scaleExtent([zoomMin, zoomMax]); fitScaleBar(scaleBar, svgWidth, svgHeight); if (window.fitLegendBox) fitLegendBox(); diff --git a/modules/ui/submap-tool.js b/modules/ui/submap-tool.js index 6586b1e7..1c992b7a 100644 --- a/modules/ui/submap-tool.js +++ b/modules/ui/submap-tool.js @@ -49,6 +49,8 @@ function openSubmapTool() { const projection = (x, y) => [(x - x0) * scale, (y - y0) * scale]; const inverse = (x, y) => [x / scale + x0, y / scale + y0]; + applyGraphSize(); + fitMapToScreen(); resetZoom(0); undraw(); Resample.process({projection, inverse, scale}); diff --git a/modules/ui/transform-tool.js b/modules/ui/transform-tool.js index 81ac984f..86d5c504 100644 --- a/modules/ui/transform-tool.js +++ b/modules/ui/transform-tool.js @@ -132,9 +132,12 @@ async function openTransformTool() { const [projection, inverse] = getProjection(); + applyGraphSize(); + fitMapToScreen(); resetZoom(0); undraw(); Resample.process({projection, inverse, scale: 1}); + drawLayers(); INFO && console.groupEnd("transformMap"); diff --git a/versioning.js b/versioning.js index cc02cdbf..8125e816 100644 --- a/versioning.js +++ b/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.106.1"; +const VERSION = "1.106.2"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {