Current Version(without the save changes)

This commit is contained in:
StempunkDev 2023-07-28 15:39:34 +02:00
parent 0936a03c60
commit 104fd9b8d5
5 changed files with 14 additions and 17 deletions

16
main.js
View file

@ -184,7 +184,8 @@ let options = {
pinNotes: false, pinNotes: false,
showMFCGMap: true, showMFCGMap: true,
winds: [225, 45, 225, 315, 135, 315], winds: [225, 45, 225, 315, 135, 315],
SouthPoleTemperature: 0, tempNorthPole: 0,
tempSouthPole: 0,
stateLabelsMode: "auto" stateLabelsMode: "auto"
}; };
let mapCoordinates = {}; // map coordinates on globe let mapCoordinates = {}; // map coordinates on globe
@ -1009,13 +1010,14 @@ function calculateTemperatures() {
TIME && console.time("calculateTemperatures"); TIME && console.time("calculateTemperatures");
const cells = grid.cells; const cells = grid.cells;
cells.temp = new Int8Array(cells.i.length); // temperature array cells.temp = new Int8Array(cells.i.length); // temperature array
const tEq = +temperatureEquatorInput.value; const tEq = +temperatureEquatorInput.value;
const tNPole = +temperatureNorthPoleInput.value; const tNorthPole = +temperatureNorthPoleInput.value;
//TODO Find proper delta to calculate const tSouthPole = +temperatureSouthPoleInput.value;
const tSPole = +temperatureSouthPoleInput.value; //Update Settings to match the slider(there may be a better solution)
const tNDelta = tEq - tNPole; options.tempSouthPole = +tSouthPole;
const tSDelta = tEq - tSPole; options.tempNorthPole = +tNorthPole;
const tNDelta = tEq - tNorthPole;
const tSDelta = tEq - tSouthPole;
const int = d3.easePolyInOut.exponent(0.5); // interpolation function const int = d3.easePolyInOut.exponent(0.5); // interpolation function
d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) { d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) {

View file

@ -639,6 +639,7 @@ export function resolveVersionConflicts(version) {
if (version < 1.89) { if (version < 1.89) {
//May need a major bump //May need a major bump
options.SouthPoleTemperature = +temperatureNorthPoleInput.value; options.tempNorthPole = +temperatureNorthPoleInput.value;
options.tempSouthPole = +temperatureNorthPoleInput.value;
} }
} }

View file

@ -589,7 +589,7 @@ async function parseLoadedData(data) {
// set options // set options
yearInput.value = options.year; yearInput.value = options.year;
eraInput.value = options.era; eraInput.value = options.era;
temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = options.SouthPoleTemperature; temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = options.tempSouthPole;
shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision"; shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision";
if (window.restoreDefaultEvents) restoreDefaultEvents(); if (window.restoreDefaultEvents) restoreDefaultEvents();

View file

@ -613,12 +613,8 @@ function randomizeOptions() {
if (randomize || !locked("temperatureEquator")) if (randomize || !locked("temperatureEquator"))
temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax); temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax);
if (randomize || !locked("temperaturePole")) { if (randomize || !locked("temperaturePole")) {
temperatureNorthPoleOutput.value temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = rand(tMin, tMin + 30);
= temperatureNorthPoleInput.value temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = rand(tMin, tMin + 30);
= temperatureSouthPoleOutput.value
= temperatureSouthPoleInput.value
= options.SouthPoleTemperature
= rand(tMin, tMin + 30);
} }

View file

@ -111,8 +111,6 @@ function editWorld() {
document.getElementById("temperatureNorthPoleF").innerHTML = rn((tNorthPole * 9) / 5 + 32); document.getElementById("temperatureNorthPoleF").innerHTML = rn((tNorthPole * 9) / 5 + 32);
const tSouthPole = +document.getElementById("temperatureSouthPoleOutput").value; const tSouthPole = +document.getElementById("temperatureSouthPoleOutput").value;
document.getElementById("temperatureSouthPoleF").innerHTML = rn((tSouthPole * 9) / 5 + 32); document.getElementById("temperatureSouthPoleF").innerHTML = rn((tSouthPole * 9) / 5 + 32);
//Update Settings to match the slider(there may be a better solution)
options.SouthPoleTemperature = +tSouthPole;
globe.selectAll(".tempGradient90").attr("stop-color", clr(1 - (tNorthPole - tMin) / (tMax - tMin))); globe.selectAll(".tempGradient90").attr("stop-color", clr(1 - (tNorthPole - tMin) / (tMax - tMin)));
globe.selectAll(".tempGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 2) / 3 - tMin) / (tMax - tMin))); globe.selectAll(".tempGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 2) / 3 - tMin) / (tMax - tMin)));
globe.selectAll(".tempGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 1) / 3 - tMin) / (tMax - tMin))); globe.selectAll(".tempGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 1) / 3 - tMin) / (tMax - tMin)));