fix: religions and cultures are not highlightable from editor

This commit is contained in:
Azgaar 2022-06-08 21:12:31 +03:00
parent 9215a01548
commit 182c6d558d
6 changed files with 30 additions and 26 deletions

View file

@ -189,7 +189,7 @@ function culturesEditorAddLines() {
}
lines += /* html */ `<div
class="states cultures"
class="states"
data-id="${c.i}"
data-name="${c.name}"
data-color="${c.color}"
@ -242,19 +242,21 @@ function culturesEditorAddLines() {
byId("culturesFooterPopulation").dataset.population = totalPopulation;
// add listeners
$body.querySelectorAll("div.cultures").forEach(el => el.on("mouseenter", cultureHighlightOn));
$body.querySelectorAll("div.cultures").forEach(el => el.on("mouseleave", cultureHighlightOff));
$body.querySelectorAll("div.states").forEach(el => el.on("click", selectCultureOnLineClick));
$body.querySelectorAll("fill-box").forEach(el => el.on("click", cultureChangeColor));
$body.querySelectorAll("div > input.cultureName").forEach(el => el.on("input", cultureChangeName));
$body.querySelectorAll("div > span.icon-cw").forEach(el => el.on("click", cultureRegenerateName));
$body.querySelectorAll("div > input.cultureExpan").forEach(el => el.on("input", cultureChangeExpansionism));
$body.querySelectorAll("div > select.cultureType").forEach(el => el.on("change", cultureChangeType));
$body.querySelectorAll("div > select.cultureBase").forEach(el => el.on("change", cultureChangeBase));
$body.querySelectorAll("div > select.cultureEmblems").forEach(el => el.on("change", cultureChangeEmblemsShape));
$body.querySelectorAll("div > div.culturePopulation").forEach(el => el.on("click", changePopulation));
$body.querySelectorAll("div > span.icon-arrows-cw").forEach(el => el.on("click", cultureRegenerateBurgs));
$body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.on("click", cultureRemovePrompt));
$body.querySelectorAll(":scope > div").forEach($line => {
$line.on("mouseenter", cultureHighlightOn);
$line.on("mouseleave", cultureHighlightOff);
$line.on("click", selectCultureOnLineClick);
});
$body.querySelectorAll("fill-box").forEach($el => $el.on("click", cultureChangeColor));
$body.querySelectorAll("div > input.cultureName").forEach($el => $el.on("input", cultureChangeName));
$body.querySelectorAll("div > span.icon-cw").forEach($el => $el.on("click", cultureRegenerateName));
$body.querySelectorAll("div > input.cultureExpan").forEach($el => $el.on("input", cultureChangeExpansionism));
$body.querySelectorAll("div > select.cultureType").forEach($el => $el.on("change", cultureChangeType));
$body.querySelectorAll("div > select.cultureBase").forEach($el => $el.on("change", cultureChangeBase));
$body.querySelectorAll("div > select.cultureEmblems").forEach($el => $el.on("change", cultureChangeEmblemsShape));
$body.querySelectorAll("div > div.culturePopulation").forEach($el => $el.on("click", changePopulation));
$body.querySelectorAll("div > span.icon-arrows-cw").forEach($el => $el.on("click", cultureRegenerateBurgs));
$body.querySelectorAll("div > span.icon-trash-empty").forEach($el => $el.on("click", cultureRemovePrompt));
const $culturesHeader = byId("culturesHeader");
$culturesHeader.querySelector("div[data-sortby='emblems']").style.display = selectShape ? "inline-block" : "none";

View file

@ -229,9 +229,11 @@ function religionsEditorAddLines() {
byId("religionsFooterPopulation").dataset.population = totalPopulation;
// add listeners
$body.querySelectorAll("div.religions").forEach(el => el.on("mouseenter", religionHighlightOn));
$body.querySelectorAll("div.religions").forEach(el => el.on("mouseleave", religionHighlightOff));
$body.querySelectorAll("div.states").forEach(el => el.on("click", selectReligionOnLineClick));
$body.querySelectorAll(":scope > div").forEach($line => {
$line.on("mouseenter", religionHighlightOn);
$line.on("mouseleave", religionHighlightOff);
$line.on("click", selectReligionOnLineClick);
});
$body.querySelectorAll("fill-box").forEach(el => el.on("click", religionChangeColor));
$body.querySelectorAll("div > input.religionName").forEach(el => el.on("input", religionChangeName));
$body.querySelectorAll("div > select.religionType").forEach(el => el.on("change", religionChangeType));

View file

@ -303,10 +303,10 @@ function statesEditorAddLines() {
byId("statesFooterPopulation").dataset.population = totalPopulation;
// add listeners
$body.querySelectorAll("div.states").forEach(el => {
el.on("click", selectStateOnLineClick);
el.on("mouseenter", stateHighlightOn);
el.on("mouseleave", stateHighlightOff);
$body.querySelectorAll(":scope > div").forEach($line => {
$line.on("mouseenter", stateHighlightOn);
$line.on("mouseleave", stateHighlightOff);
$line.on("click", selectStateOnLineClick);
});
if ($body.dataset.type === "percentage") {