diff --git a/package.json b/package.json index 37c2ba5a..54950292 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fantasy-map-generator", - "version": "1.110.0", + "version": "1.113.2", "description": "Azgaar's _Fantasy Map Generator_ is a free web application that helps fantasy writers, game masters, and cartographers create and edit fantasy maps.", "homepage": "https://github.com/Azgaar/Fantasy-Map-Generator#readme", "bugs": { diff --git a/public/modules/ui/labels-editor.js b/public/modules/ui/labels-editor.js index 8c47ec99..48af9f09 100644 --- a/public/modules/ui/labels-editor.js +++ b/public/modules/ui/labels-editor.js @@ -42,7 +42,10 @@ function editLabel() { byId("labelSizeShow").on("click", showSizeSection); byId("labelSizeHide").on("click", hideSizeSection); + byId("labelOffsetShow").on("click", showOffsetSection); + byId("labelOffsetHide").on("click", hideOffsetSection); byId("labelStartOffset").on("input", changeStartOffset); + byId("labelStartOffsetValue").on("input", changeStartOffsetFromValue); byId("labelRelativeSize").on("input", changeRelativeSize); byId("labelLetterSpacingShow").on("click", showLetterSpacingSection); @@ -83,7 +86,9 @@ function editLabel() { function updateValues(textPath) { byId("labelText").value = [...textPath.querySelectorAll("tspan")].map(tspan => tspan.textContent).join("|"); - byId("labelStartOffset").value = parseFloat(textPath.getAttribute("startOffset")); + const startOffset = parseFloat(textPath.getAttribute("startOffset")); + byId("labelStartOffset").value = startOffset; + byId("labelStartOffsetValue").value = startOffset; byId("labelRelativeSize").value = parseFloat(textPath.getAttribute("font-size")); let letterSpacingSize = textPath.getAttribute("letter-spacing") ? textPath.getAttribute("letter-spacing") : 0; byId("labelLetterSpacingSize").value = parseFloat(letterSpacingSize); @@ -346,6 +351,16 @@ function editLabel() { byId("labelSizeSection").style.display = "none"; } + function showOffsetSection() { + document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "none")); + byId("labelOffsetSection").style.display = "inline-block"; + } + + function hideOffsetSection() { + document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "inline-block")); + byId("labelOffsetSection").style.display = "none"; + } + function showLetterSpacingSection() { document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "none")); byId("labelLetterSpacingSection").style.display = "inline-block"; @@ -357,8 +372,18 @@ function editLabel() { } function changeStartOffset() { - elSelected.select("textPath").attr("startOffset", this.value + "%"); - tip("Label offset: " + this.value + "%"); + const value = this.value; + byId("labelStartOffsetValue").value = value; + elSelected.select("textPath").attr("startOffset", value + "%"); + tip("Label offset: " + value + "%"); + } + + function changeStartOffsetFromValue() { + const value = Math.min(80, Math.max(20, this.value)); + byId("labelStartOffset").value = value; + this.value = value; + elSelected.select("textPath").attr("startOffset", value + "%"); + tip("Label offset: " + value + "%"); } function changeRelativeSize() { diff --git a/public/versioning.js b/public/versioning.js index 892d2ea5..95af88e1 100644 --- a/public/versioning.js +++ b/public/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.113.1"; +const VERSION = "1.113.2"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); { diff --git a/src/index.html b/src/index.html index 25d1b3e9..88753f3a 100644 --- a/src/index.html +++ b/src/index.html @@ -2748,18 +2748,10 @@ + + +