From fe239ce29ba4b33ed9f5cdc91355c4d573c5663b Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 29 Sep 2018 00:33:52 +0300 Subject: [PATCH] v. 0.60.13b Enhancement: Borders highlight --- index.css | 2 +- script.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/index.css b/index.css index e84914be..5a4ab64e 100644 --- a/index.css +++ b/index.css @@ -74,7 +74,7 @@ button, select, a { } #regions { - stroke-width: 0; + stroke-width: 2; stroke: none; fill-rule: evenodd; stroke-linejoin: round; diff --git a/script.js b/script.js index e08a7d9d..6bcfb88c 100644 --- a/script.js +++ b/script.js @@ -8481,6 +8481,7 @@ function fantasyMap() { countriesFooterArea.innerHTML = si(totalArea) + unit; countriesFooterPopulation.innerHTML = si(totalPopulation); // handle events + $("#countriesBody .states").hover(focusOnState, unfocusState); $(".enlange").click(function() { const s = +(this.parentNode.id).slice(5); const capital = states[s].capital; @@ -8498,7 +8499,7 @@ function fantasyMap() { $("div[aria-describedby='burgsEditor'] .ui-dialog-title").text("Burgs of " + this.value).prepend(color); } } - }).hover(focusStates, unfocus); + }); $(".states > .stateColor").on("change", function() { const s = +(this.parentNode.id).slice(5); states[s].color = this.value; @@ -8832,10 +8833,16 @@ function fantasyMap() { } // onhover style functions - function focusStates() { - const s = +(this.parentNode.id).slice(5); - const l = labels.select("#regionLabel" + s); - l.classed("drag", true); + function focusOnState() { + const s = +(this.id).slice(5); + labels.select("#regionLabel" + s).classed("drag", true); + document.getElementsByClassName("region" + s)[0].style.stroke = "#000000"; + } + + function unfocusState() { + const s = +(this.id).slice(5); + labels.select("#regionLabel" + s).classed("drag", false); + document.getElementsByClassName("region" + s)[0].style.stroke = "none"; } function focusCapital() {