Drive: the limit as a round sign at the speed field's end (the next one under it), the speed red past it; the Limit cell gone, Speed over 4 cells, and no surface in its place (the terrain panel's head has it). Terrain view in the Menu: opens and closes by itself / opens and stays / by hand; simulated, the tilt doesn't open it (the DEM's slope on a hillside road is the hill's). Desktop: the sun times in the status bar (the chart opens over it), the night button out of the top bar — On the map's Theme row and drive mode still cycle it
This commit is contained in:
1 parent
f981b80599
commit
f15fbef746
6 files changed
+72
-36
No files matched your search
@@ -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
|
||||
|
||||
+41
-12
@@ -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; }
|
||||
@@ -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" },
|
||||
|
||||
+22
-15
@@ -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) {
|
||||
<button type="button" class="drive-menu__row" data-action="overview">The whole route <small>the follow pauses</small></button>
|
||||
<button type="button" class="drive-menu__row" data-action="terrain-auto"></button>
|
||||
<button type="button" class="drive-menu__row" data-action="leave">Leave driving mode</button>`;
|
||||
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"} <small>tap to switch</small>`; };
|
||||
const renderAuto = () => { autoButton.innerHTML = `Terrain view: ${TERRAIN_MODES[terrainMode()]} <small>tap to switch</small>`; };
|
||||
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"
|
||||
? `<span class="drive-speed__limit" aria-label="Limit ${limit}"><b>${limit === "unlimited" ? "∞" : limit}</b>${next ? `<small>${escapeHtml(next)}</small>` : ""}</span>` : "";
|
||||
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 = `<span class="drive-cell__label">${FIELDS[name] || name}</span><span class="drive-cell__value ${cls}">${escapeHtml(value)} <small>${escapeHtml(unit)}</small></span>`;
|
||||
const name = cell.value;
|
||||
const [value, unit, cls = "", extra = ""] = fieldValue(name, a);
|
||||
el.innerHTML = `${extra}<span class="drive-cell__label">${FIELDS[name] || name}</span><span class="drive-cell__value ${cls}">${escapeHtml(value)} <small>${escapeHtml(unit)}</small></span>`;
|
||||
} else if (cell.widget === "maneuver") renderManeuver(el);
|
||||
else if (cell.widget === "status") {
|
||||
el.innerHTML = `<b class="drive-status__brand">MAPTOOL</b><span class="drive-cell__muted"><span class="${navigator.onLine ? "drive-status--ok" : ""}">●</span> ${navigator.onLine ? "online" : "offline"}${log?.active ? ` · <span class="drive-status--rec">● rec</span>` : ""}</span>`;
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
+3
-4
@@ -2,13 +2,11 @@
|
||||
<header class="topbar">
|
||||
<span class="topbar__brand" title="rev <%= revision %>">MapTool</span>
|
||||
<div class="topbar__search"></div>
|
||||
<span class="topbar__center">
|
||||
<span class="topbar__sun" title="Sun & moon" hidden></span>
|
||||
</span>
|
||||
<span class="topbar__center"></span>
|
||||
<div class="sun-chart" hidden></div>
|
||||
<span class="topbar__offline-status" hidden></span>
|
||||
<button type="button" class="topbar__update" hidden></button>
|
||||
<button type="button" class="topbar__night"></button>
|
||||
<button type="button" class="topbar__night" hidden></button> <!-- the cycle On the map's Theme row and drive mode use; no place of its own in the bar -->
|
||||
<div class="topbar__auth">
|
||||
<% if logged_in %>
|
||||
<span><%= user %></span>
|
||||
@@ -29,6 +27,7 @@
|
||||
<span class="statusbar__cursor"></span>
|
||||
<span class="statusbar__zoom"></span>
|
||||
<span class="statusbar__rev">rev <%= revision %></span>
|
||||
<span class="statusbar__sun" title="Sun & moon" hidden></span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user