mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
feat: submap - add checkbox submapRescaleBurgStyles
This commit is contained in:
parent
0bd331f564
commit
2073de6e85
2 changed files with 22 additions and 14 deletions
17
index.html
17
index.html
|
|
@ -5775,11 +5775,18 @@
|
|||
Don't forget to save the .map file to your machine first!
|
||||
</p>
|
||||
|
||||
<div style="display: flex; gap: 1em">
|
||||
<div>Points number</div>
|
||||
<div>
|
||||
<input id="submapPointsInput" type="range" min="1" max="13" value="4" />
|
||||
<output id="submapPointsFormatted" style="color: #053305">10K</output>
|
||||
<div style="display: flex; flex-direction: column; gap: 0.5em">
|
||||
<div data-tip="Set points (cells) number of the submap" style="display: flex; gap: 1em">
|
||||
<div>Points number</div>
|
||||
<div>
|
||||
<input id="submapPointsInput" type="range" min="1" max="13" value="4" />
|
||||
<output id="submapPointsFormatted" style="color: #053305">10K</output>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div data-tip="Check to fit burg styles (icon and label size) to the submap scale">
|
||||
<input type="checkbox" class="checkbox" id="submapRescaleBurgStyles" checked />
|
||||
<label for="submapRescaleBurgStyles" class="checkbox-label">Rescale burg styles</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ function openSubmapTool() {
|
|||
resetZoom(0);
|
||||
undraw();
|
||||
Resample.process({projection, inverse, scale});
|
||||
rescaleBurgStyles(scale);
|
||||
|
||||
if (byId("submapRescaleBurgStyles").checked) rescaleBurgStyles(scale);
|
||||
drawLayers();
|
||||
|
||||
INFO && console.groupEnd("generateSubmap");
|
||||
|
|
@ -78,17 +79,17 @@ function openSubmapTool() {
|
|||
|
||||
function rescaleBurgStyles(scale) {
|
||||
const burgIcons = [...byId("burgIcons").querySelectorAll("g")];
|
||||
for (const bi of burgIcons) {
|
||||
const newRadius = rn(minmax(bi.getAttribute("size") * scale, 0.2, 10), 2);
|
||||
changeRadius(newRadius, bi.id);
|
||||
const swAttr = bi.attributes["stroke-width"];
|
||||
swAttr.value = +swAttr.value * scale;
|
||||
for (const group of burgIcons) {
|
||||
const newRadius = rn(minmax(group.getAttribute("size") * scale, 0.2, 10), 2);
|
||||
changeRadius(newRadius, group.id);
|
||||
const strokeWidth = group.attributes["stroke-width"];
|
||||
strokeWidth.value = strokeWidth.value * scale;
|
||||
}
|
||||
|
||||
const burgLabels = [...byId("burgLabels").querySelectorAll("g")];
|
||||
for (const bl of burgLabels) {
|
||||
const size = +bl.dataset["size"];
|
||||
bl.dataset["size"] = Math.max(rn((size + size / scale) / 2, 2), 1) * scale;
|
||||
for (const group of burgLabels) {
|
||||
const size = +group.dataset.size;
|
||||
group.dataset.size = Math.max(rn((size + size / scale) / 2, 2), 1) * scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue