diff --git a/index.html b/index.html index ccb9ef5a..d42ddad6 100644 --- a/index.html +++ b/index.html @@ -8563,7 +8563,7 @@ - + @@ -8576,8 +8576,8 @@ - - + + diff --git a/modules/dynamic/auto-update.js b/modules/dynamic/auto-update.js index fed78cce..a3190e3b 100644 --- a/modules/dynamic/auto-update.js +++ b/modules/dynamic/auto-update.js @@ -977,49 +977,40 @@ export function resolveVersionConflicts(mapVersion) { // v1.109.0 added customizable burg groups and icons options.burgs = {groups: []}; - // default groups were 'cities' and 'towns' - const iconGroups = burgIcons.selectAll("g"); - const citiesGroup = burgIcons.select("#cities"); - const townsGroup = burgIcons.select("#towns"); - if (!iconGroups.size() || (iconGroups.size() === 2 && citiesGroup.size() && townsGroup.size())) { - // it looks the loaded map has old default groups - options.burgs.groups = Burgs.getDefaultGroups(); - } else { - burgIcons.selectAll("circle, use").each(function () { - const group = this.parentNode.id; - const id = this.id.replace(/^burg/, ""); - const burg = pack.burgs[id]; - if (group && burg) burg.group = group; - }); + burgIcons.selectAll("circle, use").each(function () { + const group = this.parentNode.id; + const id = this.id.replace(/^burg/, ""); + const burg = pack.burgs[id]; + if (group && burg) burg.group = group; + }); - burgIcons.selectAll("g").each(function (_el, index) { - const name = this.id; - const isDefault = name === "towns"; - options.burgs.groups.push({name, active: true, order: index + 1, isDefault, preview: "watabou-city"}); - if (!this.dataset.icon) this.dataset.icon = "#icon-circle"; + burgIcons.selectAll("g").each(function (_el, index) { + const name = this.id; + const isDefault = name === "towns"; + options.burgs.groups.push({name, active: true, order: index + 1, isDefault, preview: "watabou-city"}); + if (!this.dataset.icon) this.dataset.icon = "#icon-circle"; - const size = Number(this.getAttribute("size") || 2) * 2; - this.removeAttribute("size"); - this.setAttribute("font-size", size); + const size = Number(this.getAttribute("size") || 2) * 2; + this.removeAttribute("size"); + this.setAttribute("font-size", size); - this.setAttribute("stroke-width", 1); - }); + this.setAttribute("stroke-width", 1); + }); - if (options.burgs.groups.filter(g => g.isDefault).length === 0) { - options.burgs.groups[0].isDefault = true; - } - - anchors.selectAll("g").each(function () { - const size = Number(this.getAttribute("size") || 1); - this.removeAttribute("size"); - this.setAttribute("font-size", size); - }); - - burgLabels.selectAll("g").each(function () { - if (!this.dataset.dy) this.dataset.dy = -0.4; - }); + if (options.burgs.groups.filter(g => g.isDefault).length === 0) { + options.burgs.groups[0].isDefault = true; } + anchors.selectAll("g").each(function () { + const size = Number(this.getAttribute("size") || 1); + this.removeAttribute("size"); + this.setAttribute("font-size", size); + }); + + burgLabels.selectAll("g").each(function () { + if (!this.dataset.dy) this.dataset.dy = -0.4; + }); + const anchorSymbol = byId("icon-anchor"); if (anchorSymbol) { anchorSymbol.outerHTML = /* html */ ` diff --git a/modules/io/load.js b/modules/io/load.js index e831619e..689757b2 100644 --- a/modules/io/load.js +++ b/modules/io/load.js @@ -472,7 +472,7 @@ async function parseLoadedData(data, mapVersion) { { // dynamically import and run auto-update script - const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.109.3"); + const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.109.4"); resolveVersionConflicts(mapVersion); } diff --git a/modules/renderers/draw-burg-icons.js b/modules/renderers/draw-burg-icons.js index 5952ec81..66d2dfcb 100644 --- a/modules/renderers/draw-burg-icons.js +++ b/modules/renderers/draw-burg-icons.js @@ -31,11 +31,13 @@ function drawBurgIcons() { } function drawBurgIcon(burg) { - removeBurgIcon(burg.i); - const iconGroup = burgIcons.select("#" + burg.group); - if (iconGroup.empty()) return; + if (iconGroup.empty()) { + drawBurgIcons(); + return; // redraw all icons if group is missing + } + removeBurgIcon(burg.i); const icon = iconGroup.attr("data-icon") || "#icon-circle"; burgIcons .select("#" + burg.group) diff --git a/modules/renderers/draw-burg-labels.js b/modules/renderers/draw-burg-labels.js index 721025a2..c8a43bbb 100644 --- a/modules/renderers/draw-burg-labels.js +++ b/modules/renderers/draw-burg-labels.js @@ -33,13 +33,16 @@ function drawBurgLabels() { } function drawBurgLabel(burg) { - removeBurgLabel(burg.i); - const labelGroup = burgLabels.select("#" + burg.group); - if (labelGroup.empty()) return; + if (labelGroup.empty()) { + drawBurgLabels(); + return; // redraw all labels if group is missing + } + const dx = labelGroup.attr("data-dx") || 0; const dy = labelGroup.attr("data-dy") || 0; + removeBurgLabel(burg.i); labelGroup .append("text") .attr("text-rendering", "optimizeSpeed") diff --git a/versioning.js b/versioning.js index 7a85e285..f3bd90b9 100644 --- a/versioning.js +++ b/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.109.3"; +const VERSION = "1.109.4"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {