From 7901d75ff125927d27417cf13ab48310e287539d Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Wed, 2 Dec 2026 18:21:09 +0100 Subject: [PATCH] =?UTF-8?q?Drive=20mode:=20the=20Trip=20menu=20beside=20th?= =?UTF-8?q?e=20map=20instead=20of=20over=20it=20(like=20Android=20Auto's?= =?UTF-8?q?=20side=20panel):=20the=20map=20narrower=20and=20keeping=20its?= =?UTF-8?q?=20buttons,=20its=20center=20(follow,=20the=20crosshair,=20the?= =?UTF-8?q?=20overview)=20in=20what's=20seen=20=E2=80=94=20the=20car=20was?= =?UTF-8?q?=20hidden=20under=20the=20panel=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.adoc | 3 +++ public/css/style.css | 15 +++++++-------- public/js/driving.js | 23 ++++++++--------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/TODO.adoc b/TODO.adoc index f47ca89..fc770c7 100644 --- a/TODO.adoc +++ b/TODO.adoc @@ -102,6 +102,9 @@ plan from — the server does the heavy lifting. The UI is built for a mouse tod (zoom ±, view, overview), Follow and "Back to the position" one button shown only when not following, 76×76 px; night and exit off the bar ** [ ] 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 + signalk-pypilot-newui): the map narrower, its buttons kept, its center (follow, crosshair, + overview) in what's seen — the car was hidden under the panel before (2026-12-02) ** [x] Driving menu, Trip: the stops as 76 px rows (tap to look, ↑ ↓ ✕), a stop at the crosshair, the start moved to the car (`driving.js`, `RoutePanelControl#stops` & co.) Then: search (saved points + offline places, nearest the crosshair first, + adds), each diff --git a/public/css/style.css b/public/css/style.css index fe12361..d1cbe1b 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -3595,15 +3595,12 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; } :root[data-palette] .drive-bar button, :root[data-palette] .drive-bar__recenter { box-shadow: 0 0 0 1px var(--ui-line), 0 2px 8px rgb(0 0 0 / 0.35); } -/* The driving mode's Trip menu (driving.js): big rows, big actions, on the - right; the crosshair in the middle of what's left of the map. */ +/* The driving mode's Trip menu (driving.js): big rows, big actions, beside + the map on the right (the map narrower, its buttons kept, like Android + Auto); the crosshair in the middle of the map. */ .drive-trip { - position: absolute; - top: 12px; - right: 12px; - bottom: 12px; - z-index: 5; - width: min(540px, 48%); + flex: 0 0 min(540px, 45%); + margin: 12px; display: flex; flex-direction: column; border-radius: 14px; @@ -3656,6 +3653,8 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; } .drive-bar button.active { background: var(--accent); } .drive-crosshair { position: absolute; + left: 50%; + top: 50%; z-index: 4; width: 44px; height: 44px; diff --git a/public/js/driving.js b/public/js/driving.js index 80a9ec6..918ab42 100644 --- a/public/js/driving.js +++ b/public/js/driving.js @@ -79,15 +79,6 @@ export function setupDriving(map, nightButton, routePanel) { const crosshair = document.createElement("div"); crosshair.className = "drive-crosshair"; crosshair.hidden = true; - const visibleCenter = () => { - const { clientWidth: w, clientHeight: h } = map.getContainer(); - return [(w - tripPanel.offsetWidth) / 2, h / 2]; - }; - const placeCrosshair = () => { - const [x, y] = visibleCenter(); - crosshair.style.left = `${x}px`; - crosshair.style.top = `${y}px`; - }; // Search: saved points (the library) and places (the offline POI // database), nearest the crosshair first; a result's name shows it, + adds // it as a stop. While there's a query the list shows results, not stops. @@ -103,7 +94,7 @@ export function setupDriving(map, nightButton, routePanel) { } searchTimer = setTimeout(async () => { const mine = ++searchSeq; - const { lng, lat } = map.unproject(visibleCenter()); + const { lng, lat } = map.getCenter(); const url = new URL("/api/search", window.location.origin); url.search = new URLSearchParams({ q: input.value, sources: "layers,places", lat, lng }); let found = []; @@ -115,7 +106,7 @@ export function setupDriving(map, nightButton, routePanel) { }); const lookAt = (lngLat) => { pauseFollow(map); - map.easeTo({ center: lngLat, zoom: Math.max(map.getZoom(), 14), padding: { right: tripPanel.offsetWidth } }); + map.easeTo({ center: lngLat, zoom: Math.max(map.getZoom(), 14) }); }; const renderResults = (list) => { list.replaceChildren(...results.map((r) => { @@ -163,12 +154,11 @@ export function setupDriving(map, nightButton, routePanel) { bar.querySelector(".drive-bar__trip").classList.toggle("active", open); if (open) { renderTrip(); - placeCrosshair(); } } tripPanel.querySelector(".drive-trip__close").addEventListener("click", () => openTrip(false)); tripPanel.querySelector('[data-action="add"]').addEventListener("click", () => { - const { lng, lat } = map.unproject(visibleCenter()); + const { lng, lat } = map.getCenter(); routePanel?.addStop([lng, lat]); }); tripPanel.querySelector('[data-action="start"]').addEventListener("click", () => routePanel?.startHere()); @@ -228,8 +218,11 @@ export function setupDriving(map, nightButton, routePanel) { }); if (isLoggedIn()) pollLog(); else tripPanel.querySelector(".drive-trip__log").hidden = true; - window.addEventListener("resize", placeCrosshair); - map.getContainer().append(bar, recenter, tripPanel, crosshair); + map.getContainer().append(bar, recenter, crosshair); + // the Trip menu beside the map, not over it (like Android Auto's side + // panel): the map gets narrower and keeps its buttons, its center (the + // follow, the crosshair, the overview) stays in what's seen + map.getContainer().after(tripPanel); const render = () => { bar.querySelector(".drive-bar__pitch").textContent = map.getPitch() > 0 ? "2D" : "3D";