diff --git a/public/css/style.css b/public/css/style.css index fa4d8eb..d8671fe 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -4688,9 +4688,13 @@ html.driving .dash-card { display: none; } /* the grid's cells and its Terrain v cells (roll as a rear view, pitch as a side view), the fields ahead, the elevation of the next 2 km, the actions at the foot. */ .drive-terrain__dial { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; } -.drive-terrain__dial[data-key="roll"] { grid-area: 2 / 1 / 5 / 4; } -.drive-terrain__dial[data-key="pitch"] { grid-area: 2 / 4 / 5 / 8; } -.drive-terrain__svg { width: 100%; max-width: calc(var(--cell, 80px) * 2.9); max-height: calc(var(--cell, 80px) * 2); min-height: 0; flex: 1; color: var(--band-fg); } +/* every row a cell, as on the artboard; what a bigger screen adds goes to a + blank row above the buttons, not into the dials and fields */ +.drive-panel.drive-terrain { grid-template-rows: repeat(7, var(--cell, 80px)) minmax(0, 1fr) var(--cell, 80px); } +.drive-terrain__spare { grid-area: 8 / 1 / 9 / -1; } +.drive-terrain__dial[data-dial="roll"] { grid-area: 2 / 1 / 5 / 4; } +.drive-terrain__dial[data-dial="pitch"] { grid-area: 2 / 4 / 5 / 8; } +.drive-terrain__svg { width: 100%; max-width: calc(var(--cell, 80px) * 2.9); max-height: calc(var(--cell, 80px) * 2); min-height: 0; flex: 1 1 0; color: var(--band-fg); } .drive-terrain__svg path, .drive-terrain__svg line { fill: none; } .drive-terrain__ok, .drive-terrain__amber, .drive-terrain__red { stroke-width: 10; } .drive-terrain__ok { stroke: var(--inst-ok); opacity: 0.55; } @@ -4699,8 +4703,9 @@ html.driving .dash-card { display: none; } /* the grid's cells and its Terrain v .drive-terrain__ground { stroke: var(--drive-muted); stroke-width: 1; stroke-dasharray: 4 5; } .drive-terrain__mast { stroke: currentColor; stroke-width: 3; } .drive-terrain__svg .drive-terrain__car { fill: currentColor; } +.drive-terrain__svg .drive-terrain__wheel { stroke: var(--band); stroke-width: 4; } .drive-terrain__svg .drive-terrain__peak { fill: var(--band-fg); opacity: 0.8; } -.drive-terrain__value { font-size: calc(44px * var(--s, 1)); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } +.drive-terrain__value { font-size: calc(36px * var(--s, 1)); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } .drive-terrain--caution { color: var(--inst-caution); } .drive-terrain__field { display: flex; flex-direction: column; justify-content: center; padding: 6px 12px; overflow: hidden; } .drive-terrain__field[data-field="heading"] { grid-area: 5 / 1 / 6 / 3; } @@ -4710,9 +4715,9 @@ html.driving .dash-card { display: none; } /* the grid's cells and its Terrain v .drive-panel button.drive-terrain__level, .drive-panel button.drive-terrain__reset, .drive-panel button.drive-terrain__road { font-size: calc(17px * var(--s, 1)); font-weight: 700; } -.drive-terrain__level { grid-area: 8 / 1 / 9 / 4; } -.drive-terrain__reset { grid-area: 8 / 4 / 9 / 6; } -.drive-terrain__road { grid-area: 8 / 6 / 9 / 8; } +.drive-terrain__level { grid-area: -2 / 1 / -1 / 4; } +.drive-terrain__reset { grid-area: -2 / 4 / -1 / 6; } +.drive-terrain__road { grid-area: -2 / 6 / -1 / 8; } .drive-panel button.drive-terrain__level--armed { background: var(--inst-caution); color: #000; } /* Drive keys (canvas GridKeys): the key that does a button in its corner, the diff --git a/public/js/drive_menus.js b/public/js/drive_menus.js index 4ab0635..b02776e 100644 --- a/public/js/drive_menus.js +++ b/public/js/drive_menus.js @@ -357,8 +357,16 @@ const ACROSS_AT_M = 50; // the side slope this far ahead, over ±ACROSS_HALF_M const ACROSS_HALF_M = 15; const AHEAD_EVERY_MS = 2000; // DEM lookups at most this often const CARDINALS = ["N", "NE", "E", "SE", "S", "SW", "W", "NW"]; -const CAR_REAR = "M-46 30 L-46 -4 L-34 -34 L34 -34 L46 -4 L46 30 Z M-50 30 h22 v12 h-22 Z M28 30 h22 v12 h-22 Z"; -const CAR_SIDE = "M-62 26 L-62 -2 L-30 -6 L-18 -30 L40 -30 L52 -4 L62 -2 L62 26 Z"; +// The cars stand on the ground line (y 30) and turn about its middle: body +// with the windows cut out (evenodd), wheels drawn over it with a gap round them. +const CAR_REAR = { + body: "M-54 10 L-54 -14 L-44 -18 L-34 -46 L34 -46 L44 -18 L54 -14 L54 10 Z M-27 -40 L-23 -24 L23 -24 L27 -40 Z", + wheels: "M-50 30 V4 h20 V30 Z M30 30 V4 h20 V30 Z", +}; +const CAR_SIDE = { + body: "M-64 14 L-64 -10 L-34 -14 L-20 -42 L34 -42 L46 -14 L64 -10 L64 14 Z M-16 -36 L-24 -18 L4 -18 L4 -36 Z M10 -36 L10 -18 L38 -18 L30 -36 Z", + wheels: "M-52 16 a14 14 0 1 0 28 0 a14 14 0 1 0 -28 0 Z M26 16 a14 14 0 1 0 28 0 a14 14 0 1 0 -28 0 Z", +}; const dialPoint = (a) => { const r = ((a - 90) * Math.PI) / 180; return `${(120 * Math.cos(r)).toFixed(1)} ${(30 + 120 * Math.sin(r)).toFixed(1)}`; }; const arc = (a, b, cls) => ``; const severity = (key, v) => (v == null ? "" : Math.abs(v) >= WARN[key] * 1.5 ? "drive-cell--warn" : Math.abs(v) >= WARN[key] ? "drive-terrain--caution" : ""); @@ -367,12 +375,13 @@ const offset = ([lon, lat], bearing, m) => [lon + (m * Math.sin(bearing * RAD)) export function terrainMenu(ctx) { const el = panel("drive-terrain", "Terrain", ` -
-
+
+
+
`); @@ -407,7 +416,7 @@ export function terrainMenu(ctx) { ${arc(-w, w, "drive-terrain__ok")}${arc(-w * 1.5, -w, "drive-terrain__amber")}${arc(w, w * 1.5, "drive-terrain__amber")} ${arc(-DIAL_MAX, -w * 1.5, "drive-terrain__red")}${arc(w * 1.5, DIAL_MAX, "drive-terrain__red")} - ${mark} + ${mark} ${value == null ? "—" : `${sign(Math.round(value))}${Math.abs(Math.round(value))}°`} ${key} · max ${p == null ? "—" : `${Math.abs(Math.round(p))}°`}`; @@ -421,7 +430,7 @@ export function terrainMenu(ctx) { const v = dash?.values || {}; for (const key of ["roll", "pitch"]) { if (v[key] != null && (peak[key] == null || Math.abs(v[key]) > Math.abs(peak[key]))) peak[key] = v[key]; - el.querySelector(`[data-key="${key}"]`).innerHTML = dial(key, v[key]); + el.querySelector(`[data-dial="${key}"]`).innerHTML = dial(key, v[key]); } const h = dash?.heading; const deg = h ? Math.round(h.deg) % 360 : null;