diff --git a/TODO.adoc b/TODO.adoc
index 46c74b0..6b4ed97 100644
--- a/TODO.adoc
+++ b/TODO.adoc
@@ -120,8 +120,10 @@ plan from — the server does the heavy lifting. The UI is built for a mouse tod
Reset), heading, climb in 300 m and side slope 50 m ahead (DEM along the course), the
route's next 2 km, Level here (can.json's levelling action, two taps), Road view; on by
itself on an unpaved surface (`/api/road` now gives Valhalla's `surface`, off a route only)
- or roll / pitch past 10° for 10 s, back after 2 km of paved road; Menu: automatic / by
- hand; while it's open the top row's Limit shows the surface. Still to do: the surface while
+ or roll / pitch past 10° for 10 s (not while simulated: the DEM's slope on a hillside road
+ is the hill's), back after 2 km of paved road; Menu: opens and closes by itself / opens and
+ stays (the inclinometer all along) / by hand; the surface in its head. The limit as a sign
+ in the speed field (the next one under it), the speed red past it. Still to do: the surface while
on a route (along the route's edges), the lanes in the manoeuvre cell, the profile served from `data/` once the editor exists
** [ ] Softkeys: the CAN keypad's labels on the screen edge next to its keys (G1000 style)
** [x] The Trip menu beside the map, not over it (Android Auto's side panel, seen again in
diff --git a/public/css/style.css b/public/css/style.css
index 1716cdf..6304181 100644
--- a/public/css/style.css
+++ b/public/css/style.css
@@ -165,16 +165,16 @@ html, body {
}
.statusbar__coords,
-.topbar__sun {
+.statusbar__sun {
display: flex;
align-items: center;
gap: 5px;
font-size: 12px;
font-variant-numeric: tabular-nums;
- color: #bbb;
+ color: inherit;
}
-.topbar__sun {
+.statusbar__sun {
gap: 14px;
}
@@ -205,16 +205,17 @@ html, body {
color: var(--ui-fg);
}
-.topbar__sun[hidden] {
+.statusbar__sun[hidden],
+.topbar__night[hidden] {
display: none;
}
-.topbar__sun {
+.statusbar__sun {
cursor: pointer;
}
-.topbar__sun:hover {
- color: #fff;
+.statusbar__sun:hover {
+ color: var(--ui-fg);
}
/* Files shared to the installed app (share_import.js), waiting to be
@@ -278,9 +279,8 @@ html, body {
readout (sun.js sunChartHtml). */
.sun-chart {
position: fixed;
- top: 52px;
- left: 50%;
- transform: translateX(-50%);
+ bottom: calc(var(--statusbar) + 6px); /* over the status bar's sun times, at its right end */
+ right: 12px;
z-index: 30;
width: 340px;
max-width: calc(100vw - 32px);
@@ -425,12 +425,12 @@ html, body {
.topbar__brand,
.topbar__auth > span,
- .topbar__sun .topbar__group:nth-child(3) {
+ .statusbar__sun .topbar__group:nth-child(3) {
display: none;
}
.topbar__center,
- .topbar__sun {
+ .statusbar__sun {
gap: 8px;
}
}
@@ -4743,3 +4743,32 @@ html.driving.drive-keys .drive-focus { outline: 3px solid #b45bd0; outline-offse
html.driving.drive-keys .drive-focus--main::after { content: "⏎"; color: #b45bd0; }
html.driving.drive-keys .drive-focus.drive-panel__eye::after { content: "␣"; color: #b45bd0; }
html.driving.drive-keys .drive-focus.drive-panel__add::after { content: "+"; color: #b45bd0; }
+
+/* Drive: the limit as a round sign at the speed field's end, the next limit under it */
+html.driving .drive-cell--field { position: relative; }
+.drive-speed__limit {
+ position: absolute;
+ right: calc(10px * var(--s, 1));
+ top: 50%;
+ transform: translateY(-50%);
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: calc(2px * var(--s, 1));
+}
+.drive-speed__limit b {
+ width: calc(var(--cell, 80px) * 0.62);
+ height: calc(var(--cell, 80px) * 0.62);
+ box-sizing: border-box;
+ border: calc(5px * var(--s, 1)) solid var(--sign-ring);
+ border-radius: 50%;
+ background: var(--sign-bg);
+ color: #111;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: calc(20px * var(--s, 1));
+ font-weight: 800;
+ font-variant-numeric: tabular-nums;
+}
+.drive-speed__limit small { font-size: calc(11px * var(--s, 1)); color: var(--drive-muted); white-space: nowrap; }
diff --git a/public/drive/road.json b/public/drive/road.json
index d630f98..05266a9 100644
--- a/public/drive/road.json
+++ b/public/drive/road.json
@@ -8,8 +8,7 @@
"menu": { "area": "2 / 10 / 10 / 17", "map": "2 / 1 / 10 / 10" },
"cells": [
{ "area": "1 / 1 / 2 / 5", "widget": "maneuver" },
- { "area": "1 / 5 / 2 / 7", "widget": "field", "value": "speed" },
- { "area": "1 / 7 / 2 / 9", "widget": "field", "value": "limit" },
+ { "area": "1 / 5 / 2 / 9", "widget": "field", "value": "speed" },
{ "area": "1 / 9 / 2 / 11", "widget": "field", "value": "altitude" },
{ "area": "1 / 11 / 2 / 13", "widget": "field", "value": "time" },
{ "area": "1 / 13 / 2 / 15", "widget": "field", "value": "sun" },
diff --git a/public/js/driving.js b/public/js/driving.js
index a385958..83c8a59 100644
--- a/public/js/driving.js
+++ b/public/js/driving.js
@@ -43,13 +43,11 @@ const NOT_YET = new Set();
// TILT_DEG for TILT_S; back to the road view after PAVED_BACK_M on paved road.
// Closed by hand while still off-road: not again until back on the road.
const UNPAVED = new Set(["compacted", "dirt", "gravel", "path", "impassable"]);
-// Valhalla's surfaces, shown in place of the limit while the terrain view is open
-const SURFACES = { paved_smooth: "Paved", paved: "Paved", paved_rough: "Rough", compacted: "Compacted", dirt: "Dirt", gravel: "Gravel", path: "Track", impassable: "Impassable" };
const TILT_DEG = 10;
const TILT_S = 10;
const PAVED_BACK_M = 2000;
const TERRAIN_AUTO_KEY = "maptool.terrainAuto";
-const FIELDS = { speed: "Speed", limit: "Limit", surface: "Surface", altitude: "Altitude", time: "Time", sun: "Sun", nextStop: "Next stop",
+const FIELDS = { speed: "Speed", limit: "Limit", altitude: "Altitude", time: "Time", sun: "Sun", nextStop: "Next stop",
toNextStop: "To next stop", etaNextStop: "ETA next stop", toEnd: "To the end" };
const CARDINALS = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"];
@@ -107,11 +105,15 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
`;
- const terrainAuto = () => { try { return localStorage.getItem(TERRAIN_AUTO_KEY) !== "hand"; } catch { return true; } };
+ // auto: opens off-road and closes back on the road; stay: opens and stays (the inclinometer all along); hand: neither
+ const TERRAIN_MODES = { auto: "opens and closes by itself", stay: "opens by itself, stays", hand: "by hand" };
+ const terrainMode = () => { try { const m = localStorage.getItem(TERRAIN_AUTO_KEY); return m in TERRAIN_MODES ? m : "auto"; } catch { return "auto"; } };
+ const terrainAuto = () => terrainMode() !== "hand";
const autoButton = menuPanel.querySelector('[data-action="terrain-auto"]');
- const renderAuto = () => { autoButton.innerHTML = `Terrain view: ${terrainAuto() ? "automatic" : "by hand"} tap to switch`; };
+ const renderAuto = () => { autoButton.innerHTML = `Terrain view: ${TERRAIN_MODES[terrainMode()]} tap to switch`; };
autoButton.addEventListener("click", () => {
- try { localStorage.setItem(TERRAIN_AUTO_KEY, terrainAuto() ? "hand" : "auto"); } catch { /* private window: not kept */ }
+ const modes = Object.keys(TERRAIN_MODES);
+ try { localStorage.setItem(TERRAIN_AUTO_KEY, modes[(modes.indexOf(terrainMode()) + 1) % modes.length]); } catch { /* private window: not kept */ }
renderAuto();
});
renderAuto();
@@ -231,7 +233,9 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
const now = Date.now();
const dt = (now - lastState) / 1000;
lastState = now;
- const tilted = Math.max(Math.abs(v.roll ?? 0), Math.abs(v.pitch ?? 0)) >= TILT_DEG;
+ // simulated, the tilt is the DEM's slope round the car — on a road cut into a hillside that's the
+ // hill's, not the car's, so it doesn't count (the surface still does); the dials still show it
+ const tilted = !state.simulated && Math.max(Math.abs(v.roll ?? 0), Math.abs(v.pitch ?? 0)) >= TILT_DEG;
tiltSince = tilted ? tiltSince ?? now : null;
offRoad = UNPAVED.has(state.surface) || (tiltSince != null && now - tiltSince >= TILT_S * 1000);
if (offRoad) pavedM = 0;
@@ -243,7 +247,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
if (offRoad && !suppressed && !openPanel) {
open(terrain.el);
autoOpened = true;
- } else if (autoOpened && openPanel === terrain.el && pavedM >= PAVED_BACK_M) open(null);
+ } else if (terrainMode() === "auto" && autoOpened && openPanel === terrain.el && pavedM >= PAVED_BACK_M) open(null);
};
function open(panel) {
if (openPanel === terrain.el && panel !== terrain.el) {
@@ -418,14 +422,17 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
const limit = nav?.limit;
const now = new Date();
switch (name) {
- case "speed":
- return [kmh == null ? "—" : Math.round(kmh), "km/h", typeof limit === "number" && kmh > limit + OVER_KMH ? "drive-cell--warn" : ""];
+ case "speed": {
+ // the limit as a sign at the field's end, the next one under it; the speed red past the limit
+ const next = nav?.next ? `${typeof nav.next.limit === "number" ? nav.next.limit : "∞"} in ${distance(nav.next.m)}` : "";
+ const sign = typeof limit === "number" || limit === "unlimited"
+ ? `${limit === "unlimited" ? "∞" : limit}${next ? `${escapeHtml(next)}` : ""}` : "";
+ return [kmh == null ? "—" : Math.round(kmh), "km/h", typeof limit === "number" && kmh > limit + OVER_KMH ? "drive-cell--warn" : "", sign];
+ }
case "limit": {
const next = nav?.next ? `· ${typeof nav.next.limit === "number" ? nav.next.limit : "∞"} in ${distance(nav.next.m)}` : "";
return [typeof limit === "number" ? limit : limit === "unlimited" ? "∞" : "—", next, "drive-cell--limit"];
}
- case "surface":
- return [SURFACES[dash?.surface] || "—", dash?.surface ? "" : "unknown", UNPAVED.has(dash?.surface) ? "drive-terrain--caution" : ""];
case "altitude":
return [v.alt == null ? "—" : Math.round(v.alt), "m"];
case "time":
@@ -494,9 +501,9 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
const a = ahead();
for (const { cell, el } of cells) {
if (cell.widget === "field") {
- const name = cell.value === "limit" && openPanel === terrain.el ? "surface" : cell.value; // off-road the surface matters, not the limit
- const [value, unit, cls = ""] = fieldValue(name, a);
- el.innerHTML = `${FIELDS[name] || name}${escapeHtml(value)} ${escapeHtml(unit)}`;
+ const name = cell.value;
+ const [value, unit, cls = "", extra = ""] = fieldValue(name, a);
+ el.innerHTML = `${extra}${FIELDS[name] || name}${escapeHtml(value)} ${escapeHtml(unit)}`;
} else if (cell.widget === "maneuver") renderManeuver(el);
else if (cell.widget === "status") {
el.innerHTML = `MAPTOOL● ${navigator.onLine ? "online" : "offline"}${log?.active ? ` · ● rec` : ""}`;
diff --git a/public/js/map.js b/public/js/map.js
index 445427c..f62b505 100644
--- a/public/js/map.js
+++ b/public/js/map.js
@@ -370,7 +370,7 @@ coordsLabel.addEventListener("click", async () => {
// barely moves between two nearby spots, not worth recomputing constantly)
// plus a periodic tick so the "Xh Ym to sunset" countdown keeps counting
// down even while the map sits still.
-const sunLabel = document.querySelector(".topbar__sun");
+const sunLabel = document.querySelector(".statusbar__sun");
const sunChart = document.querySelector(".sun-chart");
const updateSun = () => {
const { lng, lat } = map.getCenter();
diff --git a/views/index.erb b/views/index.erb
index 295c05d..91d2bfc 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -2,13 +2,11 @@