Drive mode: the Trip menu beside the map instead of over it (like Android Auto's side panel): the map narrower and keeping its buttons, its center (follow, the crosshair, the overview) in what's seen — the car was hidden under the panel before
This commit is contained in:
1 parent
3325ff5d17
commit
7901d75ff1
3 files changed
+18
-23
No files matched your search
@@ -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
|
(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
|
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)
|
** [ ] 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
|
** [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.)
|
crosshair, the start moved to the car (`driving.js`, `RoutePanelControl#stops` & co.)
|
||||||
Then: search (saved points + offline places, nearest the crosshair first, + adds), each
|
Then: search (saved points + offline places, nearest the crosshair first, + adds), each
|
||||||
|
|||||||
@@ -3595,15 +3595,12 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; }
|
|||||||
:root[data-palette] .drive-bar button,
|
: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); }
|
: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
|
/* The driving mode's Trip menu (driving.js): big rows, big actions, beside
|
||||||
right; the crosshair in the middle of what's left of the map. */
|
the map on the right (the map narrower, its buttons kept, like Android
|
||||||
|
Auto); the crosshair in the middle of the map. */
|
||||||
.drive-trip {
|
.drive-trip {
|
||||||
position: absolute;
|
flex: 0 0 min(540px, 45%);
|
||||||
top: 12px;
|
margin: 12px;
|
||||||
right: 12px;
|
|
||||||
bottom: 12px;
|
|
||||||
z-index: 5;
|
|
||||||
width: min(540px, 48%);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
@@ -3656,6 +3653,8 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; }
|
|||||||
.drive-bar button.active { background: var(--accent); }
|
.drive-bar button.active { background: var(--accent); }
|
||||||
.drive-crosshair {
|
.drive-crosshair {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
width: 44px;
|
width: 44px;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
|
|||||||
+8
-15
@@ -79,15 +79,6 @@ export function setupDriving(map, nightButton, routePanel) {
|
|||||||
const crosshair = document.createElement("div");
|
const crosshair = document.createElement("div");
|
||||||
crosshair.className = "drive-crosshair";
|
crosshair.className = "drive-crosshair";
|
||||||
crosshair.hidden = true;
|
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
|
// Search: saved points (the library) and places (the offline POI
|
||||||
// database), nearest the crosshair first; a result's name shows it, + adds
|
// 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.
|
// 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 () => {
|
searchTimer = setTimeout(async () => {
|
||||||
const mine = ++searchSeq;
|
const mine = ++searchSeq;
|
||||||
const { lng, lat } = map.unproject(visibleCenter());
|
const { lng, lat } = map.getCenter();
|
||||||
const url = new URL("/api/search", window.location.origin);
|
const url = new URL("/api/search", window.location.origin);
|
||||||
url.search = new URLSearchParams({ q: input.value, sources: "layers,places", lat, lng });
|
url.search = new URLSearchParams({ q: input.value, sources: "layers,places", lat, lng });
|
||||||
let found = [];
|
let found = [];
|
||||||
@@ -115,7 +106,7 @@ export function setupDriving(map, nightButton, routePanel) {
|
|||||||
});
|
});
|
||||||
const lookAt = (lngLat) => {
|
const lookAt = (lngLat) => {
|
||||||
pauseFollow(map);
|
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) => {
|
const renderResults = (list) => {
|
||||||
list.replaceChildren(...results.map((r) => {
|
list.replaceChildren(...results.map((r) => {
|
||||||
@@ -163,12 +154,11 @@ export function setupDriving(map, nightButton, routePanel) {
|
|||||||
bar.querySelector(".drive-bar__trip").classList.toggle("active", open);
|
bar.querySelector(".drive-bar__trip").classList.toggle("active", open);
|
||||||
if (open) {
|
if (open) {
|
||||||
renderTrip();
|
renderTrip();
|
||||||
placeCrosshair();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tripPanel.querySelector(".drive-trip__close").addEventListener("click", () => openTrip(false));
|
tripPanel.querySelector(".drive-trip__close").addEventListener("click", () => openTrip(false));
|
||||||
tripPanel.querySelector('[data-action="add"]').addEventListener("click", () => {
|
tripPanel.querySelector('[data-action="add"]').addEventListener("click", () => {
|
||||||
const { lng, lat } = map.unproject(visibleCenter());
|
const { lng, lat } = map.getCenter();
|
||||||
routePanel?.addStop([lng, lat]);
|
routePanel?.addStop([lng, lat]);
|
||||||
});
|
});
|
||||||
tripPanel.querySelector('[data-action="start"]').addEventListener("click", () => routePanel?.startHere());
|
tripPanel.querySelector('[data-action="start"]').addEventListener("click", () => routePanel?.startHere());
|
||||||
@@ -228,8 +218,11 @@ export function setupDriving(map, nightButton, routePanel) {
|
|||||||
});
|
});
|
||||||
if (isLoggedIn()) pollLog();
|
if (isLoggedIn()) pollLog();
|
||||||
else tripPanel.querySelector(".drive-trip__log").hidden = true;
|
else tripPanel.querySelector(".drive-trip__log").hidden = true;
|
||||||
window.addEventListener("resize", placeCrosshair);
|
map.getContainer().append(bar, recenter, crosshair);
|
||||||
map.getContainer().append(bar, recenter, tripPanel, 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 = () => {
|
const render = () => {
|
||||||
bar.querySelector(".drive-bar__pitch").textContent = map.getPitch() > 0 ? "2D" : "3D";
|
bar.querySelector(".drive-bar__pitch").textContent = map.getPitch() > 0 ? "2D" : "3D";
|
||||||
|
|||||||
Reference in new issue
Block a user