diff --git a/index.css b/index.css
index d5c5ef34..55e03f9a 100644
--- a/index.css
+++ b/index.css
@@ -2181,7 +2181,7 @@ svg.button {
#worldControls input[type="number"] {
border: 1px solid #e5e5e5;
padding: 0px;
- width: 3.2em;
+ width: 4em;
}
#worldControls i.icon-lock-open,
diff --git a/index.html b/index.html
index d19a4755..11faecf1 100644
--- a/index.html
+++ b/index.html
@@ -138,7 +138,7 @@
}
-
+
@@ -2557,7 +2557,9 @@
@@ -8078,7 +8088,7 @@
-
+
diff --git a/modules/ui/world-configurator.js b/modules/ui/world-configurator.js
index 0f25057e..df01c96b 100644
--- a/modules/ui/world-configurator.js
+++ b/modules/ui/world-configurator.js
@@ -5,18 +5,17 @@ function editWorld() {
title: "Configure World",
resizable: false,
width: "minmax(40em, 85vw)",
- buttons: {
- "Whole World": () => applyWorldPreset(100, 50),
- Northern: () => applyWorldPreset(33, 25),
- Tropical: () => applyWorldPreset(33, 50),
- Southern: () => applyWorldPreset(33, 75)
- },
+ buttons: {"Update world": updateWorld},
open: function () {
- const buttons = $(this).dialog("widget").find(".ui-dialog-buttonset > button");
- buttons[0].addEventListener("mousemove", () => tip("Click to set map size to cover the whole World"));
- buttons[1].addEventListener("mousemove", () => tip("Click to set map size to cover the Northern latitudes"));
- buttons[2].addEventListener("mousemove", () => tip("Click to set map size to cover the Tropical latitudes"));
- buttons[3].addEventListener("mousemove", () => tip("Click to set map size to cover the Southern latitudes"));
+ const checkbox = /* html */ `
+
+
+
`;
+ const pane = this.parentElement.querySelector(".ui-dialog-buttonpane");
+ pane.insertAdjacentHTML("afterbegin", checkbox);
+
+ const button = this.parentElement.querySelector(".ui-dialog-buttonset > button");
+ button.on("mousemove", () => tip("Apply curreny settings to the map"));
},
close: function () {
$(this).dialog("destroy");
@@ -34,12 +33,16 @@ function editWorld() {
if (modules.editWorld) return;
modules.editWorld = true;
- byId("worldControls").addEventListener("input", e => updateWorld(e.target));
- globe.select("#globeWindArrows").on("click", changeWind);
+ globe.select("#globeWindArrows").on("click", handleWindChange);
globe.select("#globeGraticule").attr("d", round(path(d3.geoGraticule()()))); // globe graticule
updateWindDirections();
- byId("restoreWinds").addEventListener("click", restoreDefaultWinds);
+ byId("worldControls").on("input", handleControlsChange);
+ byId("restoreWinds").on("click", restoreDefaultWinds);
+ byId("wcWholeWorld").on("click", () => applyWorldPreset(100, 50));
+ byId("wcNorthern").on("click", () => applyWorldPreset(33, 25));
+ byId("wcTropical").on("click", () => applyWorldPreset(33, 50));
+ byId("wcSouthern").on("click", () => applyWorldPreset(33, 75));
function updateInputValues() {
byId("temperatureEquatorInput").value = options.temperatureEquator;
@@ -55,27 +58,27 @@ function editWorld() {
byId("temperatureSouthPoleF").innerText = convertTemperature(options.temperatureSouthPole, "°F");
}
- function updateWorld(el) {
- if (el?.dataset.stored) {
- const stored = el.dataset.stored;
- byId(stored + "Input").value = el.value;
- byId(stored + "Output").value = el.value;
- lock(el.dataset.stored);
+ function handleControlsChange({target}) {
+ const stored = target.dataset.stored;
+ byId(stored + "Input").value = target.value;
+ byId(stored + "Output").value = target.value;
+ lock(stored);
- if (stored === "temperatureEquator") {
- options.temperatureEquator = Number(el.value);
- byId("temperatureEquatorF").innerText = convertTemperature(options.temperatureEquator, "°F");
- }
- if (stored === "temperatureNorthPole") {
- options.temperatureNorthPole = Number(el.value);
- byId("temperatureNorthPoleF").innerText = convertTemperature(options.temperatureNorthPole, "°F");
- }
- if (stored === "temperatureSouthPole") {
- options.temperatureSouthPole = Number(el.value);
- byId("temperatureSouthPoleF").innerText = convertTemperature(options.temperatureSouthPole, "°F");
- }
+ if (stored === "temperatureEquator") {
+ options.temperatureEquator = Number(target.value);
+ byId("temperatureEquatorF").innerText = convertTemperature(options.temperatureEquator, "°F");
+ } else if (stored === "temperatureNorthPole") {
+ options.temperatureNorthPole = Number(target.value);
+ byId("temperatureNorthPoleF").innerText = convertTemperature(options.temperatureNorthPole, "°F");
+ } else if (stored === "temperatureSouthPole") {
+ options.temperatureSouthPole = Number(target.value);
+ byId("temperatureSouthPoleF").innerText = convertTemperature(options.temperatureSouthPole, "°F");
}
+ if (byId("wcAutoChange").checked) updateWorld();
+ }
+
+ function updateWorld() {
updateGlobeTemperature();
updateGlobePosition();
calculateTemperatures();
@@ -130,6 +133,7 @@ function editWorld() {
[mc.lonW, mc.latN],
[mc.lonE, mc.latS]
]);
+
globe.select("#globeArea").attr("d", round(path(area.outline()))); // map area
}
@@ -163,21 +167,22 @@ function editWorld() {
});
}
- function changeWind() {
+ function handleWindChange() {
const arrow = d3.event.target.nextElementSibling;
const tier = +arrow.dataset.tier;
options.winds[tier] = (options.winds[tier] + 45) % 360;
const tr = parseTransform(arrow.getAttribute("transform"));
arrow.setAttribute("transform", `rotate(${options.winds[tier]} ${tr[1]} ${tr[2]})`);
localStorage.setItem("winds", options.winds);
+
const mapTiers = d3.range(mapCoordinates.latN, mapCoordinates.latS, -30).map(c => ((90 - c) / 30) | 0);
- if (mapTiers.includes(tier)) updateWorld();
+ if (byId("wcAutoChange").checked && mapTiers.includes(tier)) updateWorld();
}
function restoreDefaultWinds() {
const defaultWinds = [225, 45, 225, 315, 135, 315];
const mapTiers = d3.range(mapCoordinates.latN, mapCoordinates.latS, -30).map(c => ((90 - c) / 30) | 0);
- const update = mapTiers.some(t => options.winds[t] != defaultWinds[t]);
+ const update = byId("wcAutoChange").checked && mapTiers.some(t => options.winds[t] != defaultWinds[t]);
options.winds = defaultWinds;
updateWindDirections();
if (update) updateWorld();
@@ -188,6 +193,6 @@ function editWorld() {
byId("latitudeInput").value = byId("latitudeOutput").value = lat;
lock("mapSize");
lock("latitude");
- updateWorld();
+ if (byId("wcAutoChange").checked) updateWorld();
}
}
diff --git a/versioning.js b/versioning.js
index 5c5f3961..0a72c745 100644
--- a/versioning.js
+++ b/versioning.js
@@ -1,7 +1,7 @@
"use strict";
// version and caching control
-const version = "1.97.15"; // generator version, update each time
+const version = "1.97.16"; // generator version, update each time
{
document.title += " v" + version;