Planning (the Design canvas' Plan and GridToday, ideas from azedler/roadplanner): a stop's type as its NPS pictogram (marker and list), notes on the trip, its days and stops, + on a leg inserts the next point there; a parking spot per stop (P marker, the route goes there, the walk shown); a link pasted into the search becomes a place (/api/link: the URL's coordinates, else the page's geo meta / JSON-LD / a map link; public addresses only, logged in), added on the leg it lengthens least; avoids for the trip (+ ferries, unpaved) or a day (routed in pieces, joined); Check and Costs folds in the Route panel (no leave time, long days, arriving after sunset, long walks, missing vignettes; fuel from km × consumption × price, stop costs / paid, the budget); Today in drive mode's Menu (stops left, tonight, sunset, Open-Meteo weather, the day's notes, Skip next, Tomorrow). Plugins along the trip's route (Maptool::Corridor, a corridor width; Overpass around:) and plugin settings saved server-side; p4n via a host Firefox's cookies (docs/deployment.adoc). The recording's days (cut where the car stood ≥ 4 h, or by hand) and their export (days, a piece A–B, the whole trip; GPX with times). Track replay in the GNSS simulator. Step advance 5 m past a maneuver. The level gauge (drive mode, from Terrain): lift per wheel to the ramps' steps from roll, pitch, wheelbase and track
This commit is contained in:
1 parent
5e31dfaba9
commit
87d7bd2463
36 files changed
+2047
-123
No files matched your search
+29
-15
@@ -7,7 +7,7 @@ import { watchDashboard, maneuverSvg, laneSvg, distance, VOICE_KEY } from "/js/d
|
||||
import { SPEED_LIMITS, COUNTRY_NAMES, isHeavy, motorwayPayment } from "/js/speed_limits.js";
|
||||
import { currentVehicle, onVehicle } from "/js/panels.js";
|
||||
import { formatSunInfo } from "/js/sun.js";
|
||||
import { pointsMenu, layersMenu, terrainMenu, elevationHtml, cellButton, bindKey, emptyRow as empty, escapeHtml } from "/js/drive_menus.js";
|
||||
import { pointsMenu, layersMenu, terrainMenu, levelMenu, recordingMenu, todayMenu, elevationHtml, cellButton, bindKey, emptyRow as empty, escapeHtml } from "/js/drive_menus.js";
|
||||
|
||||
// Driving mode: the grid of docs/design.adoc ("Layout: a grid, not floating
|
||||
// panels"; the Design canvas' Grid) — the page becomes cells, the map one
|
||||
@@ -91,7 +91,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
tripPanel.innerHTML = `<div class="drive-panel__head">Trip <small class="drive-trip__total"></small></div>
|
||||
<button type="button" class="drive-panel__close" aria-label="Close">✕</button>
|
||||
<button type="button" class="drive-trip__log" data-action="log"></button>
|
||||
<div class="drive-trip__log-state"><span class="drive-cell__label">Recording</span><span class="drive-trip__log-text"></span></div>
|
||||
<button type="button" class="drive-trip__log-state" data-action="recording" title="The recording: its days, export"><span class="drive-cell__label">Recording ▸</span><span class="drive-trip__log-text"></span></button>
|
||||
<div class="drive-trip__search"><input type="search" aria-label="Search" placeholder="Search saved points and places…" enterkeyhint="search"></div>
|
||||
<div class="drive-trip__stops"></div>
|
||||
<div class="drive-trip__results"></div>
|
||||
@@ -105,6 +105,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
menuPanel.hidden = true;
|
||||
menuPanel.innerHTML = `<div class="drive-panel__head">Menu</div>
|
||||
<button type="button" class="drive-panel__close" aria-label="Close">✕</button>
|
||||
<button type="button" class="drive-menu__row" data-action="today">Today ▸ <small>the stops left, tonight, the weather, the day's notes</small></button>
|
||||
<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="voice"></button>
|
||||
@@ -145,6 +146,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
onVehicle(renderProfile);
|
||||
renderProfile();
|
||||
menuPanel.querySelector('[data-action="overview"]').addEventListener("click", overview);
|
||||
menuPanel.querySelector('[data-action="today"]').addEventListener("click", () => open(today.el));
|
||||
menuPanel.querySelector('[data-action="leave"]').addEventListener("click", () => set(false));
|
||||
const crosshair = document.createElement("div");
|
||||
crosshair.className = "drive-crosshair";
|
||||
@@ -247,8 +249,15 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
};
|
||||
const points = pointsMenu(menuCtx);
|
||||
const layers = layersMenu(menuCtx);
|
||||
const terrain = terrainMenu({ ...menuCtx, state: () => dash });
|
||||
const menus = [points, layers, terrain];
|
||||
const terrain = terrainMenu({ ...menuCtx, state: () => dash, openLevel: () => open(level.el) });
|
||||
const level = levelMenu({ ...menuCtx, state: () => dash, openTerrain: () => open(terrain.el) });
|
||||
const recording = recordingMenu({
|
||||
...menuCtx,
|
||||
showBounds: ([w, s, e, n]) => { pauseFollow(map); map.fitBounds([[w, s], [e, n]], { padding: 60, pitch: 0, maxZoom: 15 }); },
|
||||
endTrip: () => endTrip(),
|
||||
});
|
||||
const today = todayMenu(menuCtx);
|
||||
const menus = [points, layers, terrain, level, recording, today];
|
||||
let offRoad = false;
|
||||
let tiltSince = null;
|
||||
let pavedM = 0;
|
||||
@@ -282,6 +291,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
autoOpened = false;
|
||||
}
|
||||
if (panel !== tripPanel && results) backToStops(); // the pins go with the search
|
||||
menus.find((m) => m.el === openPanel && m.el !== panel)?.closed?.();
|
||||
openPanel = panel;
|
||||
row = 0;
|
||||
tripPanel.hidden = panel !== tripPanel;
|
||||
@@ -344,17 +354,20 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
logState.textContent = log?.active ? `● ${log.folder.replace(/^Trips\//, "")} · ${(log.distance_m / 1000).toFixed(1)} km` : "Not recording";
|
||||
logState.classList.toggle("drive-trip__log-text--on", !!log?.active);
|
||||
};
|
||||
const endTrip = async () => {
|
||||
if (!log?.active || !window.confirm(`End the trip "${log.folder}"? Its track stays in the library.`)) return;
|
||||
await fetch("/api/trip/log", { method: "DELETE" });
|
||||
driven = [];
|
||||
refreshLog();
|
||||
};
|
||||
tripPanel.querySelector('[data-action="recording"]').addEventListener("click", () => open(recording.el));
|
||||
logButton.addEventListener("click", async () => {
|
||||
if (log?.active) {
|
||||
if (!window.confirm(`End the trip "${log.folder}"? Its track stays in the library.`)) return;
|
||||
await fetch("/api/trip/log", { method: "DELETE" });
|
||||
} else {
|
||||
const ends = routePanel?.stops().at(-1)?.name || "";
|
||||
const name = window.prompt("The trip's name:", ends);
|
||||
if (name === null) return;
|
||||
const response = await fetch("/api/trip/log", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name }) });
|
||||
if (!response.ok) window.alert((await response.json().catch(() => ({}))).error || `HTTP ${response.status}`);
|
||||
}
|
||||
if (log?.active) return endTrip();
|
||||
const ends = routePanel?.stops().at(-1)?.name || "";
|
||||
const name = window.prompt("The trip's name:", ends);
|
||||
if (name === null) return;
|
||||
const response = await fetch("/api/trip/log", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name }) });
|
||||
if (!response.ok) window.alert((await response.json().catch(() => ({}))).error || `HTTP ${response.status}`);
|
||||
driven = [];
|
||||
refreshLog();
|
||||
});
|
||||
@@ -365,7 +378,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
logState.textContent = "Log in to record";
|
||||
}
|
||||
map.getContainer().append(crosshair);
|
||||
app.append(tripPanel, menuPanel, points.el, layers.el, terrain.el);
|
||||
app.append(tripPanel, menuPanel, points.el, layers.el, terrain.el, level.el, recording.el, today.el);
|
||||
|
||||
// --- the grid's cells ---------------------------------------------------
|
||||
|
||||
@@ -567,6 +580,7 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) {
|
||||
function render() {
|
||||
if (!document.documentElement.classList.contains("driving")) return;
|
||||
if (openPanel === terrain.el) terrain.render();
|
||||
if (openPanel === level.el) level.render();
|
||||
const a = ahead();
|
||||
for (const { cell, el } of cells) {
|
||||
if (cell.widget === "field") {
|
||||
|
||||
Reference in new issue
Block a user