v1.5.04 - Emblems better positioning and rescaling

This commit is contained in:
Azgaar 2021-01-30 03:23:17 +03:00
parent 549eefe7ba
commit 56b6eb2a13
5 changed files with 69 additions and 26 deletions

17
main.js
View file

@ -437,10 +437,25 @@ function invokeActiveZooming() {
const relative = Math.max(rn((desired + desired / scale) / 2, 2), 1);
this.getAttribute("font-size", relative);
const hidden = hideLabels.checked && (relative * scale < 6 || relative * scale > 50);
if (hidden) this.classList.add("hidden"); else this.classList.remove("hidden");
if (hidden) this.classList.add("hidden");
else this.classList.remove("hidden");
});
}
// 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");
// });
}
// turn off ocean pattern if scale is big (improves performance)
oceanPattern.select("rect").attr("fill", scale > 10 ? "#fff" : "url(#oceanic)").attr("opacity", scale > 10 ? .2 : null);