From 2073de6e8558b6729d5402970c86f9d7fa7c1c5c Mon Sep 17 00:00:00 2001 From: Azgaar Date: Thu, 12 Dec 2024 13:03:18 +0100 Subject: [PATCH] feat: submap - add checkbox submapRescaleBurgStyles --- index.html | 17 ++++++++++++----- modules/ui/submap-tool.js | 19 ++++++++++--------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 7be18323..9c13b43d 100644 --- a/index.html +++ b/index.html @@ -5775,11 +5775,18 @@ Don't forget to save the .map file to your machine first!

-
-
Points number
-
- - 10K +
+
+
Points number
+
+ + 10K +
+
+ +
+ +
diff --git a/modules/ui/submap-tool.js b/modules/ui/submap-tool.js index 0162e58e..6586b1e7 100644 --- a/modules/ui/submap-tool.js +++ b/modules/ui/submap-tool.js @@ -52,7 +52,8 @@ function openSubmapTool() { resetZoom(0); undraw(); Resample.process({projection, inverse, scale}); - rescaleBurgStyles(scale); + + if (byId("submapRescaleBurgStyles").checked) rescaleBurgStyles(scale); drawLayers(); INFO && console.groupEnd("generateSubmap"); @@ -78,17 +79,17 @@ function openSubmapTool() { function rescaleBurgStyles(scale) { const burgIcons = [...byId("burgIcons").querySelectorAll("g")]; - for (const bi of burgIcons) { - const newRadius = rn(minmax(bi.getAttribute("size") * scale, 0.2, 10), 2); - changeRadius(newRadius, bi.id); - const swAttr = bi.attributes["stroke-width"]; - swAttr.value = +swAttr.value * scale; + for (const group of burgIcons) { + const newRadius = rn(minmax(group.getAttribute("size") * scale, 0.2, 10), 2); + changeRadius(newRadius, group.id); + const strokeWidth = group.attributes["stroke-width"]; + strokeWidth.value = strokeWidth.value * scale; } const burgLabels = [...byId("burgLabels").querySelectorAll("g")]; - for (const bl of burgLabels) { - const size = +bl.dataset["size"]; - bl.dataset["size"] = Math.max(rn((size + size / scale) / 2, 2), 1) * scale; + for (const group of burgLabels) { + const size = +group.dataset.size; + group.dataset.size = Math.max(rn((size + size / scale) / 2, 2), 1) * scale; } } }