feat(hierarchy tree): animate on update

This commit is contained in:
Azgaar 2022-06-12 22:21:34 +03:00
parent e3ea5cd479
commit 434907fa9e
7 changed files with 106 additions and 29 deletions

View file

@ -293,7 +293,7 @@ function getShapeOptions(selectShape, selected) {
return `<select data-tip="Emblem shape associated with culture. Click to change" class="cultureEmblems hide">${options}</select>`;
}
function cultureHighlightOn(event) {
const cultureHighlightOn = debounce(event => {
const cultureId = Number(event.id || event.target.dataset.id);
if (!layerIsOn("toggleCultures")) return;
@ -312,7 +312,7 @@ function cultureHighlightOn(event) {
.transition(animate)
.attr("r", 8)
.attr("stroke", "#d0240f");
}
}, 200);
function cultureHighlightOff(event) {
const cultureId = Number(event.id || event.target.dataset.id);

View file

@ -258,7 +258,7 @@ function getTypeOptions(type) {
return options;
}
function religionHighlightOn(event) {
const religionHighlightOn = debounce(event => {
const religionId = Number(event.id || event.target.dataset.id);
const $el = $body.querySelector(`div[data-id='${religionId}']`);
if ($el) $el.classList.add("active");
@ -280,7 +280,7 @@ function religionHighlightOn(event) {
.attr("r", 8)
.attr("stroke-width", 2)
.attr("stroke", "#c13119");
}
}, 200);
function religionHighlightOff(event) {
const religionId = Number(event.id || event.target.dataset.id);