refactor: update options on load, don't update temperature UI

This commit is contained in:
Azgaar 2023-08-06 18:59:17 +04:00
parent 457db89cda
commit 1d252a1d90
2 changed files with 6 additions and 11 deletions

View file

@ -218,8 +218,7 @@ async function parseLoadedData(data) {
if (settings[13]) urbanization = urbanizationInput.value = urbanizationOutput.value = settings[13];
if (settings[14]) mapSizeInput.value = mapSizeOutput.value = minmax(settings[14], 1, 100);
if (settings[15]) latitudeInput.value = latitudeOutput.value = minmax(settings[15], 0, 100);
if (settings[16]) temperatureEquatorInput.value = temperatureEquatorOutput.value = settings[16];
if (settings[17]) temperatureNorthPoleInput.value = temperatureNorthPoleOutput.value = settings[17]; //Not used see options: only for compatibility
// setting 16 and 17 (temperature) are moved to options
if (settings[18]) precInput.value = precOutput.value = settings[18];
if (settings[19]) options = JSON.parse(settings[19]);
if (settings[20]) mapName.value = settings[20];
@ -231,6 +230,9 @@ async function parseLoadedData(data) {
void (function applyOptionsToUI() {
stateLabelsModeInput.value = options.stateLabelsMode;
yearInput.value = options.year;
eraInput.value = options.era;
shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision";
})();
void (function parseConfiguration() {
@ -586,13 +588,6 @@ async function parseLoadedData(data) {
if (rulers && layerIsOn("toggleRulers")) rulers.draw();
if (layerIsOn("toggleGrid")) drawGrid();
// set options
yearInput.value = options.year;
eraInput.value = options.era;
temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = options.temperatureNorthPole;
temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = options.temperatureSouthPole;
shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision";
if (window.restoreDefaultEvents) restoreDefaultEvents();
focusOn(); // based on searchParams focus on point, cell or burg
invokeActiveZooming();

View file

@ -24,8 +24,8 @@ function getMapData() {
urbanization,
mapSizeOutput.value,
latitudeOutput.value,
temperatureEquatorOutput.value,
0, //Dummy for tempNorthOutput.value
0, // previously used for temperatureEquatorOutput.value
0, // previously used for tempNorthOutput.value
precOutput.value,
JSON.stringify(options),
mapName.value,