mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix font size settings
This commit is contained in:
parent
7d299ff395
commit
1f10a8e281
2 changed files with 17 additions and 9 deletions
|
|
@ -578,13 +578,21 @@ styleFontMinus.addEventListener("click", function () {
|
|||
});
|
||||
|
||||
function changeFontSize(size) {
|
||||
const legend = styleElementSelect.value === "legend";
|
||||
const coords = styleElementSelect.value === "coordinates";
|
||||
|
||||
const desSize = legend ? size : coords ? rn(size / scale ** 0.8, 2) : rn(size + size / scale);
|
||||
getEl().attr("data-size", size).attr("font-size", desSize);
|
||||
styleFontSize.value = size;
|
||||
if (legend) redrawLegend();
|
||||
|
||||
const getSizeOnScale = element => {
|
||||
// some labels are rescaled on zoom
|
||||
if (element === "labels") return Math.max(rn((size + size / scale) / 2, 2), 1);
|
||||
if (element === "coordinates") return rn(size / scale ** 0.8, 2);
|
||||
|
||||
// other has the same size
|
||||
return size;
|
||||
};
|
||||
|
||||
const scaleSize = getSizeOnScale(styleElementSelect.value);
|
||||
getEl().attr("data-size", size).attr("font-size", scaleSize);
|
||||
|
||||
if (styleElementSelect.value === "legend") redrawLegend();
|
||||
}
|
||||
|
||||
styleRadiusInput.addEventListener("change", function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue