Skip to content

Commit f57b9ab

Browse files
committed
Update version to 1.113.2 and enhance label editor functionality with offset controls
1 parent 4149374 commit f57b9ab

File tree

4 files changed

+53
-13
lines changed

4 files changed

+53
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fantasy-map-generator",
3-
"version": "1.110.0",
3+
"version": "1.113.2",
44
"description": "Azgaar's _Fantasy Map Generator_ is a free web application that helps fantasy writers, game masters, and cartographers create and edit fantasy maps.",
55
"homepage": "https://github.com/Azgaar/Fantasy-Map-Generator#readme",
66
"bugs": {

public/modules/ui/labels-editor.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ function editLabel() {
4242

4343
byId("labelSizeShow").on("click", showSizeSection);
4444
byId("labelSizeHide").on("click", hideSizeSection);
45+
byId("labelOffsetShow").on("click", showOffsetSection);
46+
byId("labelOffsetHide").on("click", hideOffsetSection);
4547
byId("labelStartOffset").on("input", changeStartOffset);
48+
byId("labelStartOffsetValue").on("input", changeStartOffsetFromValue);
4649
byId("labelRelativeSize").on("input", changeRelativeSize);
4750

4851
byId("labelLetterSpacingShow").on("click", showLetterSpacingSection);
@@ -83,7 +86,9 @@ function editLabel() {
8386

8487
function updateValues(textPath) {
8588
byId("labelText").value = [...textPath.querySelectorAll("tspan")].map(tspan => tspan.textContent).join("|");
86-
byId("labelStartOffset").value = parseFloat(textPath.getAttribute("startOffset"));
89+
const startOffset = parseFloat(textPath.getAttribute("startOffset"));
90+
byId("labelStartOffset").value = startOffset;
91+
byId("labelStartOffsetValue").value = startOffset;
8792
byId("labelRelativeSize").value = parseFloat(textPath.getAttribute("font-size"));
8893
let letterSpacingSize = textPath.getAttribute("letter-spacing") ? textPath.getAttribute("letter-spacing") : 0;
8994
byId("labelLetterSpacingSize").value = parseFloat(letterSpacingSize);
@@ -346,6 +351,16 @@ function editLabel() {
346351
byId("labelSizeSection").style.display = "none";
347352
}
348353

354+
function showOffsetSection() {
355+
document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "none"));
356+
byId("labelOffsetSection").style.display = "inline-block";
357+
}
358+
359+
function hideOffsetSection() {
360+
document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "inline-block"));
361+
byId("labelOffsetSection").style.display = "none";
362+
}
363+
349364
function showLetterSpacingSection() {
350365
document.querySelectorAll("#labelEditor > button").forEach(el => (el.style.display = "none"));
351366
byId("labelLetterSpacingSection").style.display = "inline-block";
@@ -357,8 +372,18 @@ function editLabel() {
357372
}
358373

359374
function changeStartOffset() {
360-
elSelected.select("textPath").attr("startOffset", this.value + "%");
361-
tip("Label offset: " + this.value + "%");
375+
const value = this.value;
376+
byId("labelStartOffsetValue").value = value;
377+
elSelected.select("textPath").attr("startOffset", value + "%");
378+
tip("Label offset: " + value + "%");
379+
}
380+
381+
function changeStartOffsetFromValue() {
382+
const value = Math.min(80, Math.max(20, this.value));
383+
byId("labelStartOffset").value = value;
384+
this.value = value;
385+
elSelected.select("textPath").attr("startOffset", value + "%");
386+
tip("Label offset: " + value + "%");
362387
}
363388

364389
function changeRelativeSize() {

public/versioning.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
1414
*/
1515

16-
const VERSION = "1.113.1";
16+
const VERSION = "1.113.2";
1717
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
1818

1919
{

src/index.html

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,23 +2748,38 @@
27482748
<button id="labelSizeShow" data-tip="Show the font size section" class="icon-text-height"></button>
27492749
<div id="labelSizeSection" style="display: none">
27502750
<button id="labelSizeHide" data-tip="Hide the font size section" class="icon-text-height"></button>
2751+
<span data-tip="Set relative size for the particular label">Size:</span>
2752+
<input
2753+
id="labelRelativeSize"
2754+
data-tip="Set relative size for the particular label (% of group default)"
2755+
type="number"
2756+
min="30"
2757+
max="300"
2758+
step="1"
2759+
style="width: 4.5em"
2760+
/>
2761+
</div>
2762+
2763+
<button id="labelOffsetShow" data-tip="Show the label offset section" class="icon-sliders"></button>
2764+
<div id="labelOffsetSection" style="display: none">
2765+
<button id="labelOffsetHide" data-tip="Hide the label offset section" class="icon-sliders"></button>
2766+
<span data-tip="Set starting offset for the particular label">Offset:</span>
27512767
<input
27522768
id="labelStartOffset"
2753-
data-tip="Set starting offset for the particular label"
2769+
data-tip="Set starting offset for the particular label (% along the path)"
27542770
type="range"
27552771
min="20"
27562772
max="80"
27572773
style="width: 8em"
27582774
/>
2759-
<i class="icon-text-height"></i>
27602775
<input
2761-
id="labelRelativeSize"
2762-
data-tip="Set relative size for the particular label"
2776+
id="labelStartOffsetValue"
27632777
type="number"
2764-
min="30"
2765-
max="300"
2778+
min="20"
2779+
max="80"
27662780
step="1"
2767-
style="width: 4.5em"
2781+
style="width: 3.5em"
2782+
data-tip="Set starting offset numerically"
27682783
/>
27692784
</div>
27702785

@@ -8548,7 +8563,7 @@
85488563
<script defer src="modules/ui/ice-editor.js?v=1.111.0"></script>
85498564
<script defer src="modules/ui/lakes-editor.js?v=1.106.0"></script>
85508565
<script defer src="modules/ui/coastline-editor.js?v=1.99.00"></script>
8551-
<script defer src="modules/ui/labels-editor.js?v=1.106.0"></script>
8566+
<script defer src="modules/ui/labels-editor.js?v=1.113.2"></script>
85528567
<script defer src="modules/ui/rivers-editor.js?v=1.106.0"></script>
85538568
<script defer src="modules/ui/rivers-creator.js?v=1.106.0"></script>
85548569
<script defer src="modules/ui/relief-editor.js?v=1.99.00"></script>

0 commit comments

Comments
 (0)