mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.85 - restrict max UI size to screen size
This commit is contained in:
parent
d3cf46e15f
commit
cb88ab9229
1 changed files with 11 additions and 4 deletions
|
|
@ -116,8 +116,6 @@ optionsContent.addEventListener("input", function(event) {
|
||||||
else if (id === "manorsInput") changeBurgsNumberSlider(value);
|
else if (id === "manorsInput") changeBurgsNumberSlider(value);
|
||||||
else if (id === "religionsInput") religionsOutput.value = value;
|
else if (id === "religionsInput") religionsOutput.value = value;
|
||||||
else if (id === "emblemShape") changeEmblemShape(value);
|
else if (id === "emblemShape") changeEmblemShape(value);
|
||||||
else if (id === "uiSizeInput") uiSizeOutput.value = value;
|
|
||||||
else if (id === "uiSizeOutput") changeUIsize(value);
|
|
||||||
else if (id === "tooltipSizeInput" || id === "tooltipSizeOutput") changeTooltipSize(value);
|
else if (id === "tooltipSizeInput" || id === "tooltipSizeOutput") changeTooltipSize(value);
|
||||||
else if (id === "transparencyInput") changeDialogsTransparency(value);
|
else if (id === "transparencyInput") changeDialogsTransparency(value);
|
||||||
});
|
});
|
||||||
|
|
@ -127,7 +125,7 @@ optionsContent.addEventListener("change", function(event) {
|
||||||
const id = event.target.id, value = event.target.value;
|
const id = event.target.id, value = event.target.value;
|
||||||
if (id === "zoomExtentMin" || id === "zoomExtentMax") changeZoomExtent(value);
|
if (id === "zoomExtentMin" || id === "zoomExtentMax") changeZoomExtent(value);
|
||||||
else if (id === "optionsSeed") generateMapWithSeed();
|
else if (id === "optionsSeed") generateMapWithSeed();
|
||||||
else if (id === "uiSizeInput") changeUIsize(value);
|
else if (id === "uiSizeInput" || id === "uiSizeOutput") changeUIsize(value);
|
||||||
else if (id === "yearInput") changeYear();
|
else if (id === "yearInput") changeYear();
|
||||||
else if (id === "eraInput") changeEra();
|
else if (id === "eraInput") changeEra();
|
||||||
});
|
});
|
||||||
|
|
@ -342,12 +340,20 @@ function changeBurgsNumberSlider(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeUIsize(value) {
|
function changeUIsize(value) {
|
||||||
if (isNaN(+value) || +value > 4 || +value < .5) return;
|
if (isNaN(+value) || +value < .5) return;
|
||||||
|
|
||||||
|
const max = getUImaxSize();
|
||||||
|
if (+value > max) value = max;
|
||||||
|
|
||||||
uiSizeInput.value = uiSizeOutput.value = value;
|
uiSizeInput.value = uiSizeOutput.value = value;
|
||||||
document.getElementsByTagName("body")[0].style.fontSize = value * 11 + "px";
|
document.getElementsByTagName("body")[0].style.fontSize = value * 11 + "px";
|
||||||
document.getElementById("options").style.width = value * 300 + "px";
|
document.getElementById("options").style.width = value * 300 + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getUImaxSize() {
|
||||||
|
return rn(Math.min(window.innerHeight / 465, window.innerWidth / 302), 1);
|
||||||
|
}
|
||||||
|
|
||||||
function changeTooltipSize(value) {
|
function changeTooltipSize(value) {
|
||||||
tooltipSizeInput.value = tooltipSizeOutput.value = value;
|
tooltipSizeInput.value = tooltipSizeOutput.value = value;
|
||||||
tooltip.style.fontSize = `calc(${value}px + 0.5vw)`;
|
tooltip.style.fontSize = `calc(${value}px + 0.5vw)`;
|
||||||
|
|
@ -405,6 +411,7 @@ function applyStoredOptions() {
|
||||||
if (localStorage.getItem("tooltipSize")) changeTooltipSize(localStorage.getItem("tooltipSize"));
|
if (localStorage.getItem("tooltipSize")) changeTooltipSize(localStorage.getItem("tooltipSize"));
|
||||||
if (localStorage.getItem("regions")) changeStatesNumber(localStorage.getItem("regions"));
|
if (localStorage.getItem("regions")) changeStatesNumber(localStorage.getItem("regions"));
|
||||||
|
|
||||||
|
uiSizeInput.max = uiSizeOutput.max = getUImaxSize();
|
||||||
if (localStorage.getItem("uiSize")) changeUIsize(localStorage.getItem("uiSize"));
|
if (localStorage.getItem("uiSize")) changeUIsize(localStorage.getItem("uiSize"));
|
||||||
else changeUIsize(Math.max(Math.min(rn(mapWidthInput.value / 1280, 1), 2.5), 1));
|
else changeUIsize(Math.max(Math.min(rn(mapWidthInput.value / 1280, 1), 2.5), 1));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue