From ea27276558bd07d4f5acb3c5e1046cfa83434d7f Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 22 Sep 2024 20:07:55 +0200 Subject: [PATCH] fix: disable double-click on heightmap edit --- index.css | 5 +++++ index.html | 10 ++++------ main.js | 7 +++---- modules/ui/editors.js | 1 + modules/ui/heightmap-editor.js | 2 ++ versioning.js | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/index.css b/index.css index b36a0716..08c8828e 100644 --- a/index.css +++ b/index.css @@ -673,6 +673,7 @@ input[type="color"]::-webkit-color-swatch-wrapper { border: none; padding: 0.45em 0.75em; margin: 0.4em 0; + white-space: nowrap; font-family: var(--monospace); animation: glowing 2s infinite; } @@ -2388,6 +2389,10 @@ svg.button { } } +#chat-widget-container { + user-select: none; +} + #chat-widget-minimized { animation: fadeIn 1s ease-in; transform: scale(0.65); diff --git a/index.html b/index.html index e3154e9e..f11e26a6 100644 --- a/index.html +++ b/index.html @@ -2418,9 +2418,7 @@
- +
@@ -8074,14 +8072,14 @@ - + - + - + diff --git a/main.js b/main.js index eeff1f71..7afe4cf6 100644 --- a/main.js +++ b/main.js @@ -170,7 +170,7 @@ let scale = 1; let viewX = 0; let viewY = 0; -function onZoom() { +const onZoom = debounce(function () { const {k, x, y} = d3.event.transform; const isScaleChanged = Boolean(scale - k); @@ -182,9 +182,8 @@ function onZoom() { viewY = y; handleZoom(isScaleChanged, isPositionChanged); -} -const onZoomDebouced = debounce(onZoom, 50); -const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", onZoomDebouced); +}, 50); +const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", onZoom); // default options, based on Earth data let options = { diff --git a/modules/ui/editors.js b/modules/ui/editors.js index cb7b07c4..dd742aed 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -8,6 +8,7 @@ function restoreDefaultEvents() { svg.call(zoom); viewbox.style("cursor", "default").on(".drag", null).on("click", clicked).on("touchmove mousemove", onMouseMove); legend.call(d3.drag().on("start", dragLegendBox)); + svg.call(zoom); } // handle viewbox click diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js index 015303bf..20fa201c 100644 --- a/modules/ui/heightmap-editor.js +++ b/modules/ui/heightmap-editor.js @@ -112,7 +112,9 @@ function editHeightmap(options) { layersPreset.value = "heightmap"; layersPreset.disabled = true; mockHeightmap(); + viewbox.on("touchmove mousemove", moveCursor); + svg.on("dblclick.zoom", null); if (tool === "templateEditor") openTemplateEditor(); else if (tool === "imageConverter") openImageConverter(); diff --git a/versioning.js b/versioning.js index c5afab7d..d45d29a1 100644 --- a/versioning.js +++ b/versioning.js @@ -12,7 +12,7 @@ * * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.105.1"; +const VERSION = "1.105.2"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {