mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 12:31:24 +01:00
namespace for submap ui.
This commit is contained in:
parent
e85f5e39d6
commit
00a5938d6d
1 changed files with 147 additions and 156 deletions
|
|
@ -20,11 +20,10 @@ window.UISubmap = (function () {
|
|||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openRemapOptions() {
|
||||
function openRemapOptions() {
|
||||
resetZoom(0);
|
||||
$("#remapOptionsDialog").dialog({
|
||||
title: "Resampler options",
|
||||
|
|
@ -39,6 +38,7 @@ function openRemapOptions() {
|
|||
Cancel: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -51,18 +51,6 @@ function openRemapOptions() {
|
|||
console.error("Unknown cell number!");
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* callbacks */
|
||||
|
||||
const resampleCurrentMap = debounce(function () {
|
||||
// Resample the whole map to different cell resolution or shape
|
||||
const cellNumId = Number(document.getElementById("submapPointsInput").value);
|
||||
if (!cellsDensityConstants[cellNumId]) {
|
||||
console.error("Unknown cell number!");
|
||||
return;
|
||||
}
|
||||
changeCellsDensity(cellNumId);
|
||||
WARN && console.warn("Resampling current map");
|
||||
startResample({
|
||||
|
|
@ -76,9 +64,9 @@ const resampleCurrentMap = debounce(function () {
|
|||
projection: (x, y) => [x, y],
|
||||
inverse: (x, y) => [x, y]
|
||||
});
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
const generateSubmap = debounce(function () {
|
||||
const generateSubmap = debounce(function () {
|
||||
// Create submap from the current map
|
||||
// submap limits defined by the current window size (canvas viewport)
|
||||
|
||||
|
|
@ -117,9 +105,9 @@ const generateSubmap = debounce(function () {
|
|||
populationRateInput.value = populationRateOutput.value = rn((populationRate = populationRateOutput.value / scale), 2);
|
||||
customization = 0;
|
||||
startResample(options);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
async function startResample(options) {
|
||||
async function startResample(options) {
|
||||
// Do model changes with Submap.resample then do view changes if needed.
|
||||
undraw();
|
||||
resetZoom(0);
|
||||
|
|
@ -152,9 +140,9 @@ async function startResample(options) {
|
|||
turnButtonOn("toggleMarkers");
|
||||
if (ThreeD.options.isOn) ThreeD.redraw();
|
||||
if ($("#worldConfigurator").is(":visible")) editWorld();
|
||||
}
|
||||
}
|
||||
|
||||
function changeStyles(scale) {
|
||||
function changeStyles(scale) {
|
||||
// resize burgIcons
|
||||
const burgIcons = [...document.getElementById("burgIcons").querySelectorAll("g")];
|
||||
for (const bi of burgIcons) {
|
||||
|
|
@ -178,9 +166,9 @@ function changeStyles(scale) {
|
|||
emblemsProvinceSizeInput.value = minmax(+emblemsProvinceSizeInput.value * emblemMod, 0.5, 5);
|
||||
emblemsBurgSizeInput.value = minmax(+emblemsBurgSizeInput.value * emblemMod, 0.5, 5);
|
||||
drawEmblems();
|
||||
}
|
||||
}
|
||||
|
||||
function showSubmapErrorHandler(error) {
|
||||
function showSubmapErrorHandler(error) {
|
||||
ERROR && console.error(error);
|
||||
clearMainTip();
|
||||
|
||||
|
|
@ -198,4 +186,7 @@ function showSubmapErrorHandler(error) {
|
|||
},
|
||||
position: {my: "center", at: "center", of: "svg"}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {openSubmapOptions, openRemapOptions}
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue