mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
fix: year and era - unlock both on lock icon click
This commit is contained in:
parent
23e2484526
commit
d42fd5cf92
3 changed files with 13 additions and 9 deletions
|
|
@ -429,17 +429,19 @@ function highlightEmblemElement(type, el) {
|
|||
|
||||
// assign lock behavior
|
||||
document.querySelectorAll("[data-locked]").forEach(function (e) {
|
||||
e.addEventListener("mouseover", function (event) {
|
||||
e.addEventListener("mouseover", e => {
|
||||
e.stopPropagation();
|
||||
if (this.className === "icon-lock")
|
||||
tip("Click to unlock the option and allow it to be randomized on new map generation");
|
||||
else tip("Click to lock the option and always use the current value on new map generation");
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
e.addEventListener("click", function () {
|
||||
const id = this.id.slice(5);
|
||||
if (this.className === "icon-lock") unlock(id);
|
||||
else lock(id);
|
||||
const fn = this.className === "icon-lock" ? unlock : lock;
|
||||
const ids = this.dataset.ids.split(",");
|
||||
|
||||
if (ids.length) ids.forEach(fn);
|
||||
else fn(this.id.slice(5));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue