diff --git a/index.html b/index.html index aa7a5d54..69226a81 100644 --- a/index.html +++ b/index.html @@ -2363,12 +2363,18 @@
-
@@ -2427,13 +2433,13 @@ - - - + + + - - - + + + @@ -7924,14 +7930,14 @@ - - + + - - + + @@ -7967,8 +7973,8 @@ - - + + diff --git a/main.js b/main.js index e6f95d45..ebf156bb 100644 --- a/main.js +++ b/main.js @@ -184,6 +184,8 @@ let options = { pinNotes: false, showMFCGMap: true, winds: [225, 45, 225, 315, 135, 315], + tempNorthPole: 0, + tempSouthPole: 0, stateLabelsMode: "auto" }; let mapCoordinates = {}; // map coordinates on globe @@ -1008,16 +1010,20 @@ function calculateTemperatures() { TIME && console.time("calculateTemperatures"); const cells = grid.cells; cells.temp = new Int8Array(cells.i.length); // temperature array - const tEq = +temperatureEquatorInput.value; - const tPole = +temperaturePoleInput.value; - const tDelta = tEq - tPole; + const tNorthPole = +temperatureNorthPoleInput.value; + const tSouthPole = +temperatureSouthPoleInput.value; + //Update Settings to match the slider(there may be a better solution) + options.tempSouthPole = +tSouthPole; + options.tempNorthPole = +tNorthPole; + const tNDelta = tEq - tNorthPole; + const tSDelta = tEq - tSouthPole; const int = d3.easePolyInOut.exponent(0.5); // interpolation function d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) { const y = grid.points[r][1]; - const lat = Math.abs(mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT); // [0; 90] - const initTemp = tEq - int(lat / 90) * tDelta; + const lat = (mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT); // [-90; 90] + const initTemp = tEq - (Math.max(rn(lat / 90, 2), 0) * tNDelta - Math.min(rn(lat / 90, 2), 0) * tSDelta); for (let i = r; i < r + grid.cellsX; i++) { cells.temp[i] = minmax(initTemp - convertToFriendly(cells.h[i]), -128, 127); } diff --git a/modules/dynamic/auto-update.js b/modules/dynamic/auto-update.js index 6c280826..1ba05747 100644 --- a/modules/dynamic/auto-update.js +++ b/modules/dynamic/auto-update.js @@ -636,4 +636,10 @@ export function resolveVersionConflicts(version) { if (coa?.shield === "state") delete coa.shield; }); } + + if (version < 1.89) { + //May need a major bump + options.tempNorthPole = +temperatureNorthPoleInput.value; + options.tempSouthPole = +temperatureNorthPoleInput.value; + } } diff --git a/modules/dynamic/export-json.js b/modules/dynamic/export-json.js index d9e6d42e..62f6d66a 100644 --- a/modules/dynamic/export-json.js +++ b/modules/dynamic/export-json.js @@ -109,7 +109,7 @@ function getSettings() { mapSize: mapSizeOutput.value, latitudeO: latitudeOutput.value, temperatureEquator: temperatureEquatorOutput.value, - temperaturePole: temperaturePoleOutput.value, + temperaturePole: 0, //Moved to options prec: precOutput.value, options: options, mapName: mapName.value, diff --git a/modules/io/load.js b/modules/io/load.js index a3549279..e47f27ac 100644 --- a/modules/io/load.js +++ b/modules/io/load.js @@ -219,7 +219,7 @@ async function parseLoadedData(data) { 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]) temperaturePoleInput.value = temperaturePoleOutput.value = settings[17]; + if (settings[17]) temperatureNorthPoleInput.value = temperatureNorthPoleOutput.value = settings[17]; //Not used see options: only for compatibility if (settings[18]) precInput.value = precOutput.value = settings[18]; if (settings[19]) options = JSON.parse(settings[19]); if (settings[20]) mapName.value = settings[20]; @@ -589,6 +589,8 @@ async function parseLoadedData(data) { // set options yearInput.value = options.year; eraInput.value = options.era; + temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = options.tempNorthPole; + temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = options.tempSouthPole; shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision"; if (window.restoreDefaultEvents) restoreDefaultEvents(); diff --git a/modules/io/save.js b/modules/io/save.js index bf78fd0e..d471c0a2 100644 --- a/modules/io/save.js +++ b/modules/io/save.js @@ -25,7 +25,7 @@ function getMapData() { mapSizeOutput.value, latitudeOutput.value, temperatureEquatorOutput.value, - temperaturePoleOutput.value, + 0, //Dummy for tempNorthOutput.value precOutput.value, JSON.stringify(options), mapName.value, diff --git a/modules/ui/options.js b/modules/ui/options.js index 37eb3f06..44f8fdd4 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -612,8 +612,10 @@ function randomizeOptions() { tMin = -30; // temperature extremes if (randomize || !locked("temperatureEquator")) temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax); - if (randomize || !locked("temperaturePole")) - temperaturePoleOutput.value = temperaturePoleInput.value = rand(tMin, tMin + 30); + if (randomize || !locked("temperatureNorthPole")) + temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = rand(tMin, tMin + 30); + if (randomize || !locked("temperatureSouthPole")) + temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = rand(tMin, tMin + 30); // 'Units Editor' settings const US = navigator.language === "en-US"; diff --git a/modules/ui/world-configurator.js b/modules/ui/world-configurator.js index 73a3621e..635df09c 100644 --- a/modules/ui/world-configurator.js +++ b/modules/ui/world-configurator.js @@ -107,12 +107,19 @@ function editWorld() { function updateGlobeTemperature() { const tEq = +document.getElementById("temperatureEquatorOutput").value; document.getElementById("temperatureEquatorF").innerHTML = rn((tEq * 9) / 5 + 32); - const tPole = +document.getElementById("temperaturePoleOutput").value; - document.getElementById("temperaturePoleF").innerHTML = rn((tPole * 9) / 5 + 32); - globe.selectAll(".tempGradient90").attr("stop-color", clr(1 - (tPole - tMin) / (tMax - tMin))); - globe.selectAll(".tempGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tPole) * 2) / 3 - tMin) / (tMax - tMin))); - globe.selectAll(".tempGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tPole) * 1) / 3 - tMin) / (tMax - tMin))); + const tNorthPole = +document.getElementById("temperatureNorthPoleOutput").value; + document.getElementById("temperatureNorthPoleF").innerHTML = rn((tNorthPole * 9) / 5 + 32); + const tSouthPole = +document.getElementById("temperatureSouthPoleOutput").value; + document.getElementById("temperatureSouthPoleF").innerHTML = rn((tSouthPole * 9) / 5 + 32); + + //North to Equator to South + globe.select(".tempNorthGradient90").attr("stop-color", clr(1 - (tNorthPole - tMin) / (tMax - tMin))); + globe.select(".tempNorthGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 2) / 3 - tMin) / (tMax - tMin))); + globe.select(".tempNorthGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 1) / 3 - tMin) / (tMax - tMin))); globe.select(".tempGradient0").attr("stop-color", clr(1 - (tEq - tMin) / (tMax - tMin))); + globe.select(".tempSouthGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tSouthPole) * 1) / 3 - tMin) / (tMax - tMin))); + globe.select(".tempSouthGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tSouthPole) * 2) / 3 - tMin) / (tMax - tMin))); + globe.select(".tempSouthGradient90").attr("stop-color", clr(1 - (tSouthPole - tMin) / (tMax - tMin))); } function updateWindDirections() { diff --git a/versioning.js b/versioning.js index e60b7636..dc72881a 100644 --- a/versioning.js +++ b/versioning.js @@ -1,8 +1,7 @@ "use strict"; // version and caching control - -const version = "1.89.39"; // generator version, update each time +const version = "1.90.00"; // generator version, update each time { document.title += " v" + version;