diff --git a/index.html b/index.html
index 7890c3ce..a93044a0 100644
--- a/index.html
+++ b/index.html
@@ -3338,6 +3338,9 @@
+
+
+
@@ -4399,7 +4402,7 @@
-
+
diff --git a/main.js b/main.js
index 9ef68fde..c1c89d15 100644
--- a/main.js
+++ b/main.js
@@ -61,7 +61,7 @@ let coastline = viewbox.append("g").attr("id", "coastline");
let ice = viewbox.append("g").attr("id", "ice").style("display", "none");
let prec = viewbox.append("g").attr("id", "prec").style("display", "none");
let population = viewbox.append("g").attr("id", "population");
-let emblems = viewbox.append("g").attr("id", "emblems");
+let emblems = viewbox.append("g").attr("id", "emblems").style("display", "none");
let labels = viewbox.append("g").attr("id", "labels");
let icons = viewbox.append("g").attr("id", "icons");
let burgIcons = icons.append("g").attr("id", "burgIcons");
@@ -98,6 +98,11 @@ anchors.append("g").attr("id", "towns");
population.append("g").attr("id", "rural");
population.append("g").attr("id", "urban");
+// emblem groups
+emblems.append("g").attr("id", "burgEmblems");
+emblems.append("g").attr("id", "provinceEmblems");
+emblems.append("g").attr("id", "stateEmblems");
+
// fogging
fogging.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%");
fogging.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", "#e8f0f6").attr("filter", "url(#splotch)");
@@ -444,16 +449,12 @@ function invokeActiveZooming() {
// rescale emblems on zoom
if (emblems.style("display") !== "none") {
- const fontSize = rn(1 / scale ** .1, 4);
- emblems.attr("font-size", fontSize);
- // const realSize = fontSize * scale;
-
- // emblems.selectAll("use").each(function(d) {
-
- // const hidden = realSize < 20 || realSize > 350;
- // if (hidden) this.classList.add("hidden");
- // else this.classList.remove("hidden");
- // });
+ emblems.selectAll("g").each(function() {
+ const size = this.getAttribute("font-size") * scale;
+ const hidden = size < 25 || size > 300;
+ if (hidden) this.classList.add("hidden"); else this.classList.remove("hidden");
+ if (!hidden && this.children.length && !this.children[0].getAttribute("href")) renderGroupCOAs(this);
+ });
}
// turn off ocean pattern if scale is big (improves performance)
@@ -484,6 +485,18 @@ function invokeActiveZooming() {
}
}
+async function renderGroupCOAs(g) {
+ const [group, type] = g.id === "burgEmblems" ? [pack.burgs, "burg"] :
+ g.id === "provinceEmblems" ? [pack.provinces, "province"] :
+ [pack.states, "state"];
+ for (let use of g.children) {
+ const i = +use.dataset.i;
+ const id = type+"COA"+i;
+ COArenderer.trigger(id, group[i].coa);
+ use.setAttribute("href", "#"+id);
+ }
+}
+
// add drag to upload logic, pull request from @evyatron
void function addDragToUpload() {
document.addEventListener("dragover", function(e) {
diff --git a/modules/coa-generator.js b/modules/coa-generator.js
index 9250d7f7..4fff8f6a 100644
--- a/modules/coa-generator.js
+++ b/modules/coa-generator.js
@@ -208,16 +208,16 @@
// fix download svg/png
// test in FF
- const t1 = parent && P(.25) ? parent.t1 : getTincture("field");
+ const t1 = parent && P(.3) ? parent.t1 : getTincture("field");
const coa = {t1};
let charge = P(usedPattern ? .5 : .93) ? true : false; // 80% for charge
- const linedOrdinary = charge && P(.3) || P(.5) ? parent?.ordinaries && P(.2) ? parent.ordinaries[0].ordinary : rw(ordinaries.lined) : null;
+ const linedOrdinary = charge && P(.3) || P(.5) ? parent?.ordinaries && P(.3) ? parent.ordinaries[0].ordinary : rw(ordinaries.lined) : null;
const ordinary = !charge && P(.65) || P(.3) ? linedOrdinary ? linedOrdinary : rw(ordinaries.straight) : null; // 36% for ordinary
const rareDivided = ["chief", "terrace", "chevron", "quarter", "flaunches"].includes(ordinary);
const divisioned = rareDivided ? P(.03) : charge && ordinary ? P(.03) : charge ? P(.3) : ordinary ? P(.7) : P(.995); // 33% for division
const division = divisioned ? parent?.division && P(.2) ? parent.division.division : rw(divisions.variants) : null;
- if (charge) charge = parent?.charges && P(.3) ? parent.charges[0].charge : selectCharge();
+ if (charge) charge = parent?.charges && P(.2) ? parent.charges[0].charge : selectCharge();
if (division) {
const t = getTincture("division", usedTinctures, P(.98) ? coa.t1 : null);
diff --git a/modules/coa-renderer.js b/modules/coa-renderer.js
index db4db629..3f9fbadb 100644
--- a/modules/coa-renderer.js
+++ b/modules/coa-renderer.js
@@ -683,7 +683,6 @@
const viewBox = shieldBox[coa.shield] || "0 0 200 200";
const coaDefs = document.getElementById("coaDefs");
- const chargesGroup = coaDefs.querySelector("#charges");
let svg = `