mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.5.04 - Emblems better positioning and rescaling
This commit is contained in:
parent
549eefe7ba
commit
56b6eb2a13
5 changed files with 69 additions and 26 deletions
17
main.js
17
main.js
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue