From 0d71f10f05bfada9ee32c2f7b9b4b03f25a3da6b Mon Sep 17 00:00:00 2001 From: GoteGuru Date: Wed, 18 May 2022 11:56:44 +0200 Subject: [PATCH 1/5] Submap live preview. --- index.html | 5 +- modules/io/export.js | 8 ++- modules/ui/submap.js | 160 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 137 insertions(+), 36 deletions(-) diff --git a/index.html b/index.html index 6aac18d2..6493e516 100644 --- a/index.html +++ b/index.html @@ -4370,8 +4370,8 @@
Shift
- - + +
Rotate
@@ -4395,6 +4395,7 @@ +
diff --git a/modules/ui/submap.js b/modules/ui/submap.js index 9c27f4d5..2a7813e9 100644 --- a/modules/ui/submap.js +++ b/modules/ui/submap.js @@ -94,7 +94,7 @@ window.UISubmap = (function () { }; $("#resampleDialog").dialog({ - title: "Resample map", + title: "Transform map", width: "430px", resizable: false, position: {my: "center", at: "center", of: "svg"}, From 06fe93f6fd9aad0ca2175e2d4b73f5f8f46e70cd Mon Sep 17 00:00:00 2001 From: GoteGuru Date: Wed, 18 May 2022 23:40:04 +0200 Subject: [PATCH 4/5] rename resample button to Transform --- modules/ui/submap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/submap.js b/modules/ui/submap.js index 2a7813e9..ffbfecbb 100644 --- a/modules/ui/submap.js +++ b/modules/ui/submap.js @@ -99,7 +99,7 @@ window.UISubmap = (function () { resizable: false, position: {my: "center", at: "center", of: "svg"}, buttons: { - Resample: function () { + Transform: function () { $(this).dialog("close"); resampleCurrentMap(); }, From 77ae7f5bcdd600d5473d1129b4f7e5551e4a792e Mon Sep 17 00:00:00 2001 From: GoteGuru Date: Wed, 18 May 2022 23:52:21 +0200 Subject: [PATCH 5/5] Improve readability. Remove labels from preview. --- modules/ui/submap.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/ui/submap.js b/modules/ui/submap.js index ffbfecbb..38024581 100644 --- a/modules/ui/submap.js +++ b/modules/ui/submap.js @@ -81,7 +81,11 @@ window.UISubmap = (function () { // mouse drag let mouseIsDown = false, mouseX = 0, mouseY = 0; - $previewBox.onmousedown = e => [ mouseIsDown, mouseX, mouseY ] = [ true, $shiftX.value - e.clientX / previewScale, $shiftY.value - e.clientY / previewScale]; + $previewBox.onmousedown = e => { + mouseIsDown = true; + mouseX = $shiftX.value - e.clientX / previewScale; + mouseY = $shiftY.value - e.clientY / previewScale; + } $previewBox.onmouseup = _ => mouseIsDown = false; $previewBox.onmouseleave = _ => mouseIsDown = false; $previewBox.onmousemove = e => { @@ -133,9 +137,8 @@ window.UISubmap = (function () { } async function loadPreview($container, w, h) { - const url = await getMapURL("png", { globe: false, noWater: true, fullMap: true, noLabels: false, noScaleBar: true, noIce: true }); + const url = await getMapURL("png", { globe: false, noWater: true, fullMap: true, noLabels: true, noScaleBar: true, noIce: true }); - const link = document.createElement("a"); const canvas = document.createElement("canvas"); const ctx = canvas.getContext("2d"); canvas.width = w;