From 1125192b72766c3f2395342f8e37d49bba59eb4b Mon Sep 17 00:00:00 2001 From: Azgaar Date: Thu, 10 Oct 2024 00:20:55 +0200 Subject: [PATCH] feat: burg group editor - text-shadow --- modules/dynamic/auto-update.js | 6 ------ modules/ui/style-presets.js | 34 +++++----------------------------- styles/ancient.json | 8 ++++---- styles/atlas.json | 8 ++++---- styles/clean.json | 8 ++++---- styles/cyberpunk.json | 8 ++++---- styles/darkSeas.json | 8 ++++---- styles/default.json | 22 +++++++++++----------- styles/gloom.json | 8 ++++---- styles/light.json | 8 ++++---- styles/monochrome.json | 8 ++++---- styles/night.json | 8 ++++---- styles/pale.json | 8 ++++---- styles/watercolor.json | 8 ++++---- 14 files changed, 60 insertions(+), 90 deletions(-) diff --git a/modules/dynamic/auto-update.js b/modules/dynamic/auto-update.js index c06b7d12..1a8f78f6 100644 --- a/modules/dynamic/auto-update.js +++ b/modules/dynamic/auto-update.js @@ -467,12 +467,6 @@ export function resolveVersionConflicts(mapVersion) { if (oceanPattern) oceanPattern.removeAttribute("opacity"); const oceanicPattern = document.getElementById("oceanicPattern"); if (!oceanicPattern.getAttribute("opacity")) oceanicPattern.setAttribute("opacity", 0.2); - - // v 1.63 moved label text-shadow from css to editable inline style - burgLabels.select("#cities").style("text-shadow", "white 0 0 4px"); - burgLabels.select("#towns").style("text-shadow", "white 0 0 4px"); - labels.select("#states").style("text-shadow", "white 0 0 4px"); - labels.select("#addedLabels").style("text-shadow", "white 0 0 4px"); } if (isOlderThan("1.64.0")) { diff --git a/modules/ui/style-presets.js b/modules/ui/style-presets.js index 9ec256df..dbec442e 100644 --- a/modules/ui/style-presets.js +++ b/modules/ui/style-presets.js @@ -93,11 +93,7 @@ function applyStyle(styleJSON) { continue; } - if (attribute === "text-shadow") { - el.style[attribute] = value; - } else { - el.setAttribute(attribute, value); - } + el.setAttribute(attribute, value); if (selector === "#texture") { const image = document.querySelector("#texture > image"); @@ -280,32 +276,12 @@ function addStylePreset() { "data-columns" ], "#legendBox": ["fill", "fill-opacity"], - "#burgLabels > #cities": [ - "opacity", - "fill", - "text-shadow", - "letter-spacing", - "data-size", - "font-size", - "font-family" - ], - "#anchors > #cities": ["opacity", "fill", "size", "stroke", "stroke-width"], - "#burgLabels > #towns": [ - "opacity", - "fill", - "text-shadow", - "letter-spacing", - "data-size", - "font-size", - "font-family" - ], - "#anchors > #towns": ["opacity", "fill", "size", "stroke", "stroke-width"], "#labels > #states": [ "opacity", "fill", "stroke", "stroke-width", - "text-shadow", + "style", "letter-spacing", "data-size", "font-size", @@ -317,7 +293,7 @@ function addStylePreset() { "fill", "stroke", "stroke-width", - "text-shadow", + "style", "letter-spacing", "data-size", "font-size", @@ -354,14 +330,14 @@ function addStylePreset() { const burgLabelsAttributes = [ "opacity", "fill", - "text-shadow", + "style", "letter-spacing", "data-size", "font-size", "font-family" ]; options.burgs.groups.forEach(({name}) => { - attributes[`#burgIcons > g.${name}`] = burgIconsAttributes; + attributes[`#burgIcons > g#${name}`] = burgIconsAttributes; attributes[`#burgLabels > g#${name}`] = burgLabelsAttributes; }); diff --git a/styles/ancient.json b/styles/ancient.json index d57aa524..69e18b4f 100644 --- a/styles/ancient.json +++ b/styles/ancient.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 12, "font-size": 12, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 5, "font-size": 5, @@ -385,7 +385,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 22, "font-size": 22, @@ -397,7 +397,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/atlas.json b/styles/atlas.json index ef7d7f8a..a47b5d0f 100644 --- a/styles/atlas.json +++ b/styles/atlas.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 5, "font-size": 5, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -385,7 +385,7 @@ "fill": "#000000", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 21, "font-size": 21, @@ -397,7 +397,7 @@ "fill": "#000000", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/clean.json b/styles/clean.json index c5aad094..948a1bcb 100644 --- a/styles/clean.json +++ b/styles/clean.json @@ -333,7 +333,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#414141", - "text-shadow": "white 0 0 4px", + "style": "text-shadow: white 0 0 4px", "letter-spacing": 0, "data-size": 7, "font-size": 7, @@ -359,7 +359,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#414141", - "text-shadow": "none", + "style": "text-shadow: none", "letter-spacing": 0, "data-size": 3, "font-size": 3, @@ -387,7 +387,7 @@ "fill": "#292929", "stroke": "#303030", "stroke-width": 0, - "text-shadow": "white 0 0 2px", + "style": "text-shadow: white 0 0 2px", "letter-spacing": 0, "data-size": 10, "font-size": 10, @@ -399,7 +399,7 @@ "fill": "#414141", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0 0 4px", + "style": "text-shadow: white 0 0 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/cyberpunk.json b/styles/cyberpunk.json index 93f22284..b992d8bb 100644 --- a/styles/cyberpunk.json +++ b/styles/cyberpunk.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#ffffff", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 8, "font-size": 8, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#ffffff", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 3, "font-size": 3, @@ -385,7 +385,7 @@ "fill": "#ffffff", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, @@ -397,7 +397,7 @@ "fill": "#ffffff", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/darkSeas.json b/styles/darkSeas.json index 2bc90fa6..7912aa9e 100644 --- a/styles/darkSeas.json +++ b/styles/darkSeas.json @@ -320,7 +320,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 7, "font-size": 7, @@ -345,7 +345,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 5, "font-size": 5, @@ -372,7 +372,7 @@ "fill": "#000000", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 21, "font-size": 21, @@ -384,7 +384,7 @@ "fill": "#000000", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/default.json b/styles/default.json index e1f644f7..8f2841c7 100644 --- a/styles/default.json +++ b/styles/default.json @@ -331,7 +331,7 @@ "#burgLabels > g#capitals": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 7, "font-size": 7, @@ -352,7 +352,7 @@ "#burgLabels > g#cities": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 5, "font-size": 5, @@ -373,7 +373,7 @@ "#burgLabels > g#forts": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 2, "font-size": 2, @@ -394,7 +394,7 @@ "#burgLabels > g#monasteries": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 2, "font-size": 2, @@ -415,7 +415,7 @@ "#burgLabels > g#caravanserais": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 2, "font-size": 2, @@ -436,7 +436,7 @@ "#burgLabels > g#trading_posts": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 2, "font-size": 2, @@ -457,7 +457,7 @@ "#burgLabels > g#villages": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 3, "font-size": 3, @@ -478,7 +478,7 @@ "#burgLabels > g#hamlets": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 2, "font-size": 2, @@ -499,7 +499,7 @@ "#burgLabels > g#towns": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -522,7 +522,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 22, "font-size": 22, @@ -534,7 +534,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/gloom.json b/styles/gloom.json index 19318882..a72d9209 100644 --- a/styles/gloom.json +++ b/styles/gloom.json @@ -334,7 +334,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0 0 2px", + "style": "text-shadow: white 0 0 2px", "letter-spacing": 0, "data-size": 8, "font-size": 8, @@ -360,7 +360,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "none", + "style": "text-shadow: none", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -388,7 +388,7 @@ "fill": "#4e4e4e", "stroke": "#b5b5b5", "stroke-width": 0, - "text-shadow": "white 0 0 2px", + "style": "text-shadow: white 0 0 2px", "letter-spacing": 0, "data-size": 20, "font-size": 20, @@ -400,7 +400,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0 0 4px", + "style": "text-shadow: white 0 0 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/light.json b/styles/light.json index de539872..fc3e68ab 100644 --- a/styles/light.json +++ b/styles/light.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#3a3a3a", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 8, "font-size": 8, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -385,7 +385,7 @@ "fill": "#3e3e3e", "stroke": "#000000", "stroke-width": 0.3, - "text-shadow": "white 0px 0px 6px", + "style": "text-shadow: white 0px 0px 6px", "letter-spacing": 0, "data-size": 14, "font-size": 14, @@ -397,7 +397,7 @@ "fill": "#f24706", "stroke": "#701b05", "stroke-width": 0.1, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 6, "font-size": 6, diff --git a/styles/monochrome.json b/styles/monochrome.json index 1ee17c43..b320313c 100644 --- a/styles/monochrome.json +++ b/styles/monochrome.json @@ -327,7 +327,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 7, "font-size": 7, @@ -353,7 +353,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#000000", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -381,7 +381,7 @@ "fill": "#000000", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, @@ -393,7 +393,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/night.json b/styles/night.json index 67a5e799..b3e23fab 100644 --- a/styles/night.json +++ b/styles/night.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#dbdbe1", - "text-shadow": "black 0px 0px 4px", + "style": "text-shadow: black 0px 0px 4px", "letter-spacing": 0, "data-size": 8, "font-size": 8, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#ffffff", - "text-shadow": "black 0px 0px 4px", + "style": "text-shadow: black 0px 0px 4px", "letter-spacing": 0, "data-size": 4.28, "font-size": 4.28, @@ -385,7 +385,7 @@ "fill": "#5d77a2", "stroke": "#7a83ae", "stroke-width": 0.3, - "text-shadow": "black 0px 0px 0.1px", + "style": "text-shadow: black 0px 0px 0.1px", "letter-spacing": 0, "data-size": 14, "font-size": 14, @@ -397,7 +397,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "black 0px 0px 4px", + "style": "text-shadow: black 0px 0px 4px", "letter-spacing": 0, "data-size": 18, "font-size": 18, diff --git a/styles/pale.json b/styles/pale.json index 8e839600..b1b3c1a8 100644 --- a/styles/pale.json +++ b/styles/pale.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 0.8, "fill": "#3a3a3a", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 7, "font-size": 7, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 0.8, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 4, "font-size": 4, @@ -385,7 +385,7 @@ "fill": "#3e3e3e", "stroke": "#000000", "stroke-width": 0, - "text-shadow": "white 0px 0px 6px", + "style": "text-shadow: white 0px 0px 6px", "letter-spacing": 0, "data-size": 14, "font-size": 14, @@ -397,7 +397,7 @@ "fill": "#f24706", "stroke": "#701b05", "stroke-width": 0.1, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 6, "font-size": 6, diff --git a/styles/watercolor.json b/styles/watercolor.json index 982c1b49..32e542c8 100644 --- a/styles/watercolor.json +++ b/styles/watercolor.json @@ -331,7 +331,7 @@ "#burgLabels > #cities": { "opacity": 1, "fill": "#043449", - "text-shadow": "white 0px 0px 2px", + "style": "text-shadow: white 0px 0px 2px", "letter-spacing": 0, "data-size": 5, "font-size": 5, @@ -357,7 +357,7 @@ "#burgLabels > #towns": { "opacity": 1, "fill": "#3e3e4b", - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 3, "font-size": 3, @@ -385,7 +385,7 @@ "fill": "#ffffff", "stroke": "#000000", "stroke-width": 0.15, - "text-shadow": "black 1px 1px 3px", + "style": "text-shadow: black 1px 1px 3px", "letter-spacing": 0, "data-size": 18, "font-size": 18, @@ -397,7 +397,7 @@ "fill": "#3e3e4b", "stroke": "#3a3a3a", "stroke-width": 0, - "text-shadow": "white 0px 0px 4px", + "style": "text-shadow: white 0px 0px 4px", "letter-spacing": 0, "data-size": 16, "font-size": 16,