mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.65 - allow to hide certain Emblems
This commit is contained in:
parent
bc149bc65f
commit
9a20a3e4c6
5 changed files with 170 additions and 145 deletions
|
|
@ -23,6 +23,7 @@ function editEmblem(type, id, el) {
|
|||
emblemProvinces.oninput = selectProvince;
|
||||
emblemBurgs.oninput = selectBurg;
|
||||
emblemShapeSelector.oninput = changeShape;
|
||||
document.getElementById("emblemShow").onchange = toggleEmblem;
|
||||
document.getElementById("emblemsRegenerate").onclick = regenerate;
|
||||
document.getElementById("emblemsArmoria").onclick = openInArmoria;
|
||||
document.getElementById("emblemsUpload").onclick = toggleUpload;
|
||||
|
|
@ -103,6 +104,8 @@ function editEmblem(type, id, el) {
|
|||
emblemShapeSelector.disabled = false;
|
||||
emblemShapeSelector.value = el.coa.shield;
|
||||
}
|
||||
|
||||
document.getElementById("emblemShow").checked = !el.coaHidden;
|
||||
}
|
||||
|
||||
function selectState() {
|
||||
|
|
@ -159,6 +162,24 @@ function editEmblem(type, id, el) {
|
|||
highlightEmblemElement(type, el);
|
||||
}
|
||||
|
||||
function toggleEmblem() {
|
||||
el.coaHidden = !el.coaHidden;
|
||||
|
||||
const g = emblems.select("#"+type+"Emblems");
|
||||
if (el.coaHidden) g.select("[data-i='"+el.i+"']").remove();
|
||||
else {
|
||||
// re-append use element
|
||||
if (g.select("[data-i='"+el.i+"']").size()) return; // alredy displayed
|
||||
const halfSize = +g.attr("font-size") / 2;
|
||||
const x = el.x || el.pole[0];
|
||||
const y = el.y || el.pole[1];
|
||||
g.append("use").attr("data-i", el.i)
|
||||
.attr("x", rn(x - halfSize), 2).attr("y", rn(y - halfSize), 2)
|
||||
.attr("width", "1em").attr("height", "1em")
|
||||
.attr("href", "#"+id);
|
||||
}
|
||||
}
|
||||
|
||||
function regenerate() {
|
||||
let parent = null;
|
||||
if (type === "province") parent = pack.states[el.state];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue