mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
feat: style - store emblem size mod in style (v1.99.10)
This commit is contained in:
parent
634ad6cd8e
commit
f129ff5573
18 changed files with 140 additions and 44 deletions
|
|
@ -1908,21 +1908,21 @@ function drawEmblems() {
|
|||
const getStateEmblemsSize = () => {
|
||||
const startSize = minmax((graphHeight + graphWidth) / 40, 10, 100);
|
||||
const statesMod = 1 + validStates.length / 100 - (15 - validStates.length) / 200; // states number modifier
|
||||
const sizeMod = +byId("emblemsStateSizeInput").value || 1;
|
||||
const sizeMod = +emblems.select("#stateEmblems").attr("data-size") || 1;
|
||||
return rn((startSize / statesMod) * sizeMod); // target size ~50px on 1536x754 map with 15 states
|
||||
};
|
||||
|
||||
const getProvinceEmblemsSize = () => {
|
||||
const startSize = minmax((graphHeight + graphWidth) / 100, 5, 70);
|
||||
const provincesMod = 1 + validProvinces.length / 1000 - (115 - validProvinces.length) / 1000; // states number modifier
|
||||
const sizeMod = +byId("emblemsProvinceSizeInput").value || 1;
|
||||
const sizeMod = +emblems.select("#provinceEmblems").attr("data-size") || 1;
|
||||
return rn((startSize / provincesMod) * sizeMod); // target size ~20px on 1536x754 map with 115 provinces
|
||||
};
|
||||
|
||||
const getBurgEmblemSize = () => {
|
||||
const startSize = minmax((graphHeight + graphWidth) / 185, 2, 50);
|
||||
const burgsMod = 1 + validBurgs.length / 1000 - (450 - validBurgs.length) / 1000; // states number modifier
|
||||
const sizeMod = +byId("emblemsBurgSizeInput").value || 1;
|
||||
const sizeMod = +emblems.select("#burgEmblems").attr("data-size") || 1;
|
||||
return rn((startSize / burgsMod) * sizeMod); // target size ~8.5px on 1536x754 map with 450 burgs
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -337,6 +337,9 @@ function selectStyleElement() {
|
|||
styleEmblems.style.display = "block";
|
||||
styleStrokeWidth.style.display = "block";
|
||||
styleStrokeWidthInput.value = el.attr("stroke-width") || 1;
|
||||
emblemsStateSizeInput.value = emblems.select("#stateEmblems").attr("data-size") || 1;
|
||||
emblemsProvinceSizeInput.value = emblems.select("#provinceEmblems").attr("data-size") || 1;
|
||||
emblemsBurgSizeInput.value = emblems.select("#burgEmblems").attr("data-size") || 1;
|
||||
}
|
||||
|
||||
// update group options
|
||||
|
|
@ -945,9 +948,20 @@ styleArmiesSize.addEventListener("input", e => {
|
|||
});
|
||||
});
|
||||
|
||||
emblemsStateSizeInput.addEventListener("change", drawEmblems);
|
||||
emblemsProvinceSizeInput.addEventListener("change", drawEmblems);
|
||||
emblemsBurgSizeInput.addEventListener("change", drawEmblems);
|
||||
emblemsStateSizeInput.addEventListener("change", e => {
|
||||
emblems.select("#stateEmblems").attr("data-size", e.target.value);
|
||||
drawEmblems();
|
||||
});
|
||||
|
||||
emblemsProvinceSizeInput.addEventListener("change", e => {
|
||||
emblems.select("#provinceEmblems").attr("data-size", e.target.value);
|
||||
drawEmblems();
|
||||
});
|
||||
|
||||
emblemsBurgSizeInput.addEventListener("change", e => {
|
||||
emblems.select("#burgEmblems").attr("data-size", e.target.value);
|
||||
drawEmblems();
|
||||
});
|
||||
|
||||
// request a URL to image to be used as a texture
|
||||
function textureProvideURL() {
|
||||
|
|
|
|||
|
|
@ -238,6 +238,9 @@ function addStylePreset() {
|
|||
],
|
||||
"#ice": ["opacity", "fill", "stroke", "stroke-width", "filter"],
|
||||
"#emblems": ["opacity", "stroke-width", "filter"],
|
||||
"#emblems > #stateEmblems": ["data-size"],
|
||||
"#emblems > #provinceEmblems": ["data-size"],
|
||||
"#emblems > #burgEmblems": ["data-size"],
|
||||
"#texture": ["opacity", "filter", "mask", "data-x", "data-y", "data-href"],
|
||||
"#zones": ["opacity", "stroke", "stroke-width", "stroke-dasharray", "stroke-linecap", "filter", "mask"],
|
||||
"#oceanLayers": ["filter", "layers"],
|
||||
|
|
|
|||
|
|
@ -316,11 +316,6 @@ window.UISubmap = (function () {
|
|||
bl.dataset["size"] = Math.max(rn((size + size / scale) / 2, 2), 1) * scale;
|
||||
}
|
||||
|
||||
// emblems
|
||||
const emblemMod = minmax((scale - 1) * 0.3 + 1, 0.5, 5);
|
||||
emblemsStateSizeInput.value = minmax(+emblemsStateSizeInput.value * emblemMod, 0.5, 5);
|
||||
emblemsProvinceSizeInput.value = minmax(+emblemsProvinceSizeInput.value * emblemMod, 0.5, 5);
|
||||
emblemsBurgSizeInput.value = minmax(+emblemsBurgSizeInput.value * emblemMod, 0.5, 5);
|
||||
drawEmblems();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue