From d39e3b5edd478dc0d48535fba784d7dd35214643 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Thu, 3 Dec 2026 11:04:45 +0100 Subject: [PATCH] =?UTF-8?q?Drive=20on=20other=20screens=20(field=20test=20?= =?UTF-8?q?on=20a=2026=E2=80=B3):=20the=20cells=20at=20most=20the=20profil?= =?UTF-8?q?e's=2080=20px,=20on=20a=20bigger=20screen=20only=20the=20map's?= =?UTF-8?q?=20columns=20and=20rows=20stretch=20(the=20right=20column,=20th?= =?UTF-8?q?e=20menus=20and=20the=20map=20keys=20stay=20cell-sized,=20a=20l?= =?UTF-8?q?ist=20shows=20more=20rows),=20on=20a=20smaller=20one=20everythi?= =?UTF-8?q?ng=20=E2=80=94=20cells,=20type,=20icons=20=E2=80=94=20scaled=20?= =?UTF-8?q?by=20one=20factor=20so=20a=207=E2=80=B3=20keeps=20the=20same=20?= =?UTF-8?q?elements;=20a=20menu=20now=20lies=20over=20the=20cells=20of=20t?= =?UTF-8?q?he=20area=20it=20opens=20in=20(Next=20stop=20and=20the=20rest?= =?UTF-8?q?=20covered=20Terrain),=20the=20dials=20sized=20by=20the=20cell;?= =?UTF-8?q?=20the=20simulation's=20roll=20and=20pitch=20always=20from=20th?= =?UTF-8?q?e=20terrain=20under=20it,=20not=20the=20IMU=20of=20the=20car=20?= =?UTF-8?q?standing=20at=20home;=20the=20dashboard's=20card=20over=20the?= =?UTF-8?q?=20map=20hidden=20while=20driving=20(Terrain=20instead)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 120 +++++++++++++++++++++-------------------- public/drive/road.json | 1 + public/js/dashboard.js | 8 ++- public/js/driving.js | 19 +++++-- 4 files changed, 84 insertions(+), 64 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 7bf2ceb..8503ab1 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -3565,8 +3565,8 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; } :root[data-palette="night"] { --drive-line: #34332d; --drive-muted: #5f5c55; --drive-key-on: #3c4419; --drive-input: #1c1c19; --drive-eye: #8f9c4d; } html.driving #app { display: grid; - grid-template-columns: repeat(var(--drive-cols, 16), minmax(0, 1fr)); - grid-template-rows: repeat(var(--drive-rows, 10), minmax(0, 1fr)); + grid-template-columns: var(--drive-columns, repeat(16, minmax(0, 1fr))); + grid-template-rows: var(--drive-row-sizes, repeat(10, minmax(0, 1fr))); gap: 1px; background: var(--drive-line); } @@ -3586,38 +3586,38 @@ html:not(.driving) .drive-cell { display: none; } background: var(--band); color: var(--band-fg); } -.drive-cell__label { font-size: 11px; color: var(--drive-muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.drive-cell__value { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.drive-cell__value small { font-size: 13px; font-weight: 500; color: var(--drive-muted); } -.drive-cell__value--mid { font-size: 22px; } -.drive-cell--small .drive-cell__value { font-size: 22px; } -.drive-cell__muted { font-size: 12px; color: var(--drive-muted); font-weight: 400; } +.drive-cell__label { font-size: calc(11px * var(--s, 1)); color: var(--drive-muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-cell__value { font-size: calc(34px * var(--s, 1)); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-cell__value small { font-size: calc(13px * var(--s, 1)); font-weight: 500; color: var(--drive-muted); } +.drive-cell__value--mid { font-size: calc(22px * var(--s, 1)); } +.drive-cell--small .drive-cell__value { font-size: calc(22px * var(--s, 1)); } +.drive-cell__muted { font-size: calc(12px * var(--s, 1)); color: var(--drive-muted); font-weight: 400; } .drive-cell__text { display: flex; flex-direction: column; min-width: 0; } -.drive-cell__street { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-cell__street { font-size: calc(15px * var(--s, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .drive-cell--warn { color: var(--inst-warning); } -.drive-cell--caution { color: var(--inst-caution); font-size: 22px; } +.drive-cell--caution { color: var(--inst-caution); font-size: calc(22px * var(--s, 1)); } .drive-cell--limit { color: var(--sign-ring); } .drive-cell--maneuver, .drive-cell--compass { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; } -.drive-cell--maneuver .dash-banner__icon { width: 42px; height: 56px; } -.drive-status__brand { font-size: 14px; letter-spacing: 0.12em; } +.drive-cell--maneuver .dash-banner__icon { width: calc(42px * var(--s, 1)); height: calc(56px * var(--s, 1)); } +.drive-status__brand { font-size: calc(14px * var(--s, 1)); letter-spacing: 0.12em; } .drive-status--ok { color: var(--inst-ok); } .drive-status--rec { color: var(--route-driven); } -.drive-elevation { width: 100%; flex: 1; min-height: 0; max-height: 120px; } +.drive-elevation { width: 100%; flex: 1; min-height: 0; max-height: calc(120px * var(--s, 1)); } .drive-elevation__area { fill: var(--drive-muted); opacity: 0.35; } .drive-elevation__line { fill: none; stroke: var(--band-fg); stroke-width: 2; vector-effect: non-scaling-stroke; } .drive-elevation__here { stroke: var(--inst-active); stroke-width: 3; vector-effect: non-scaling-stroke; } -.drive-compass { width: 64px; height: 64px; flex: none; } +.drive-compass { width: calc(64px * var(--s, 1)); height: calc(64px * var(--s, 1)); flex: none; } .drive-compass--stale { opacity: 0.55; } .drive-compass__ring { fill: none; stroke: var(--drive-muted); stroke-width: 2; } .drive-compass__north, .drive-compass__n { fill: var(--inst-warning); } .drive-compass__south { fill: var(--drive-muted); } -.drive-compass__n { font-size: 14px; font-weight: 800; text-anchor: middle; } +.drive-compass__n { font-size: calc(14px * var(--s, 1)); font-weight: 800; text-anchor: middle; } .drive-compass__lubber { fill: var(--inst-active); } button.drive-cell--key { align-items: center; padding: 0; border: none; font: inherit; cursor: pointer; } -.drive-key__icon { font-size: 24px; line-height: 1; } -.drive-key--big .drive-key__icon { font-size: 34px; } -.drive-key__label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; } +.drive-key__icon { font-size: calc(24px * var(--s, 1)); line-height: 1; } +.drive-key--big .drive-key__icon { font-size: calc(34px * var(--s, 1)); } +.drive-key__label { font-size: calc(12px * var(--s, 1)); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; } button.drive-cell--key[aria-pressed="true"], button.drive-cell--key:active:not(:disabled) { background: var(--drive-key-on); color: #fff; } button.drive-cell--key:disabled { opacity: 0.35; cursor: default; } @@ -3627,8 +3627,8 @@ button.drive-cell--key:disabled { opacity: 0.35; cursor: default; } left: 50%; top: 50%; z-index: 4; - width: 44px; - height: 44px; + width: calc(44px * var(--s, 1)); + height: calc(44px * var(--s, 1)); margin: -22px 0 0 -22px; pointer-events: none; background: @@ -3648,7 +3648,9 @@ button.drive-cell--key:disabled { opacity: 0.35; cursor: default; } .drive-panel { display: grid; grid-template-columns: repeat(var(--drive-menu-cols, 7), minmax(0, 1fr)); - grid-template-rows: repeat(var(--drive-menu-rows, 8), minmax(0, 1fr)); + grid-template-rows: var(--cell, 80px) var(--cell, 80px) var(--cell, 80px) repeat(var(--drive-menu-mid, 4), minmax(var(--cell, 80px), 1fr)) var(--cell, 80px); + position: relative; + z-index: 1; /* over the cells of the area it opens in (they come later in the page) */ gap: 1px; min-height: 0; background: var(--drive-line); @@ -3669,35 +3671,35 @@ html.driving .drive-panel { grid-area: var(--drive-menu, 2 / 10 / 10 / 17); } color: var(--band-fg); font: inherit; } -.drive-panel button { cursor: pointer; font-size: 26px; } +.drive-panel button { cursor: pointer; font-size: calc(26px * var(--s, 1)); } .drive-panel button:disabled { opacity: 0.3; cursor: default; } .drive-panel button:active:not(:disabled) { background: var(--drive-key-on); color: #fff; } -.drive-panel__head { grid-area: 1 / 1 / 2 / -2; display: flex; align-items: center; gap: 12px; padding: 0 16px; font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; } -.drive-panel__head small { font-size: 16px; font-weight: 500; color: var(--drive-muted); } +.drive-panel__head { grid-area: 1 / 1 / 2 / -2; display: flex; align-items: center; gap: 12px; padding: 0 16px; font-size: calc(22px * var(--s, 1)); font-weight: 700; white-space: nowrap; overflow: hidden; } +.drive-panel__head small { font-size: calc(16px * var(--s, 1)); font-weight: 500; color: var(--drive-muted); } .drive-panel__close { grid-area: 1 / -2 / 2 / -1; } .drive-panel__text { display: flex; flex-direction: column; min-width: 0; text-align: left; } -.drive-panel__text b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.drive-panel__text small { font-size: 13px; color: var(--drive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.drive-panel__empty { grid-column: 1 / -1; padding: 16px; color: var(--drive-muted); font-size: 16px; } -.drive-panel button.drive-panel__primary { background: var(--drive-key-on); color: #fff; font-size: 18px; font-weight: 700; } +.drive-panel__text b { font-size: calc(19px * var(--s, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-panel__text small { font-size: calc(13px * var(--s, 1)); color: var(--drive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-panel__empty { grid-column: 1 / -1; padding: 16px; color: var(--drive-muted); font-size: calc(16px * var(--s, 1)); } +.drive-panel button.drive-panel__primary { background: var(--drive-key-on); color: #fff; font-size: calc(18px * var(--s, 1)); font-weight: 700; } /* the Trip: recording, search, the stops, the actions */ .drive-trip__log { grid-area: 2 / 1 / 3 / 4; } -.drive-panel button.drive-trip__log { font-size: 18px; font-weight: 700; color: var(--route-driven); } +.drive-panel button.drive-trip__log { font-size: calc(18px * var(--s, 1)); font-weight: 700; color: var(--route-driven); } .drive-panel button.drive-trip__log--on { background: var(--route-driven); color: #fff; } .drive-trip__log-state { grid-area: 2 / 4 / 3 / -1; display: flex; flex-direction: column; justify-content: center; padding: 0 14px; } -.drive-trip__log-text { font-size: 16px; font-weight: 600; color: var(--drive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.drive-trip__log-text--on { font-size: 18px; font-weight: 700; color: var(--route-driven); } +.drive-trip__log-text { font-size: calc(16px * var(--s, 1)); font-weight: 600; color: var(--drive-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.drive-trip__log-text--on { font-size: calc(18px * var(--s, 1)); font-weight: 700; color: var(--route-driven); } .drive-trip__search { grid-area: 3 / 1 / 4 / -1; display: flex; align-items: center; padding: 0 10px; } .drive-trip__search input { width: 100%; box-sizing: border-box; - height: 60px; + height: calc(60px * var(--s, 1)); padding: 0 16px; border: 1px solid var(--drive-line); border-radius: 8px; background: var(--drive-input); color: var(--band-fg); - font-size: 20px; + font-size: calc(20px * var(--s, 1)); } .drive-trip__stops, .drive-trip__results { @@ -3708,31 +3710,30 @@ html.driving .drive-panel { grid-area: var(--drive-menu, 2 / 10 / 10 / 17); } align-content: start; background: var(--drive-line); } -/* ponytail: rows sized for the 8-row menu (4 stops, 5 results a screen), from the profile if another menu size comes */ -.drive-trip__stops { grid-area: 4 / 1 / -2 / -1; grid-auto-rows: calc((100% - 3px) / 4); } -.drive-trip__results { grid-area: 3 / 1 / -2 / -1; grid-auto-rows: calc((100% - 4px) / 5); } +.drive-trip__stops { grid-area: 4 / 1 / -2 / -1; grid-auto-rows: var(--cell, 80px); } +.drive-trip__results { grid-area: 3 / 1 / -2 / -1; grid-auto-rows: var(--cell, 80px); } .drive-panel__stop { grid-column: 1 / -5; padding: 0 14px; display: flex; align-items: center; } .drive-panel__result { grid-column: 1 / -2; padding: 0 14px; display: flex; align-items: center; gap: 12px; } .drive-panel__passed .drive-panel__text { opacity: 0.45; } .drive-panel .drive-panel__done { color: var(--drive-muted); font-weight: 700; } .drive-panel .drive-panel__done.active { color: var(--inst-ok); } -.drive-panel .drive-panel__drop { font-size: 24px; } -.drive-panel .drive-panel__add { font-size: 32px; font-weight: 700; color: var(--drive-eye); } +.drive-panel .drive-panel__drop { font-size: calc(24px * var(--s, 1)); } +.drive-panel .drive-panel__add { font-size: calc(32px * var(--s, 1)); font-weight: 700; color: var(--drive-eye); } .drive-trip__add { grid-area: -2 / 1 / -1 / 5; } -.drive-panel button.drive-trip__start { grid-area: -2 / 5 / -1 / -1; font-size: 17px; font-weight: 700; } -.drive-panel button.drive-trip__back { grid-area: -2 / 1 / -1 / -1; font-size: 17px; font-weight: 700; } +.drive-panel button.drive-trip__start { grid-area: -2 / 5 / -1 / -1; font-size: calc(17px * var(--s, 1)); font-weight: 700; } +.drive-panel button.drive-trip__back { grid-area: -2 / 1 / -1 / -1; font-size: calc(17px * var(--s, 1)); font-weight: 700; } .drive-trip[data-mode="trip"] :is(.drive-trip__results, .drive-trip__back), .drive-trip[data-mode="search"] :is(.drive-trip__log, .drive-trip__log-state, .drive-trip__stops, .drive-trip__add, .drive-trip__start) { display: none; } .drive-trip[data-mode="search"] .drive-trip__search { grid-row: 2 / 3; } .drive-trip[data-mode="search"] .drive-trip__search input { border: 2px solid var(--drive-key-on); } /* the search's results on the map and in the list: saved points cyan, places amber */ -.drive-pin { width: 14px; height: 14px; flex: none; border-radius: 50%; box-shadow: 0 0 0 2px #fff; } -.maplibregl-marker.drive-pin { width: 18px; height: 18px; box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgb(0 0 0 / 0.4); } +.drive-pin { width: calc(14px * var(--s, 1)); height: calc(14px * var(--s, 1)); flex: none; border-radius: 50%; box-shadow: 0 0 0 2px #fff; } +.maplibregl-marker.drive-pin { width: calc(18px * var(--s, 1)); height: calc(18px * var(--s, 1)); box-shadow: 0 0 0 2.5px #fff, 0 1px 4px rgb(0 0 0 / 0.4); } .drive-pin--saved { background: #12bedf; } .drive-pin--place { background: #e8a200; } /* the Menu: a row a cell high each */ -.drive-panel button.drive-menu__row { grid-column: 1 / -1; padding: 0 16px; text-align: left; font-size: 19px; font-weight: 700; } -.drive-menu__row small { margin-left: 8px; font-size: 14px; font-weight: 400; color: var(--drive-muted); } +.drive-panel button.drive-menu__row { grid-column: 1 / -1; padding: 0 16px; text-align: left; font-size: calc(19px * var(--s, 1)); font-weight: 700; } +.drive-menu__row small { margin-left: 8px; font-size: calc(14px * var(--s, 1)); font-weight: 400; color: var(--drive-muted); } /* The side rail, labelled (map.js sets data-label), and the status bar under the map — the Design canvas' Desktop. */ @@ -4630,7 +4631,8 @@ html.driving .drive-panel { grid-area: var(--drive-menu, 2 / 10 / 10 / 17); } html.driving #map { margin-bottom: 0; } -html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instead */ +html.driving .dash-banner, +html.driving .dash-card { display: none; } /* the grid's cells and its Terrain view instead */ /* Points and Layers (drive_menus.js, the canvas' GridPoints / GridLayers): a bar of cells on top, an item a row (its eye, its + or ›), a foot. */ @@ -4638,16 +4640,16 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea grid-area: 4 / 1 / -2 / -1; display: grid; grid-template-columns: repeat(var(--drive-menu-cols, 7), minmax(0, 1fr)); - grid-auto-rows: calc((100% - 3px) / 4); /* ponytail: 4 rows a screen, as the 8-row menu */ + grid-auto-rows: var(--cell, 80px); /* a row a cell high: more of them on a taller screen */ gap: 1px; overflow-y: auto; align-content: start; background: var(--drive-line); } -.drive-panel__foot { grid-area: -2 / 1 / -1 / 5; display: flex; align-items: center; padding: 0 16px; font-size: 15px; color: var(--drive-muted); } -.drive-panel button.drive-panel__wide { grid-area: -2 / 5 / -1 / -1; font-size: 17px; font-weight: 700; } +.drive-panel__foot { grid-area: -2 / 1 / -1 / 5; display: flex; align-items: center; padding: 0 16px; font-size: calc(15px * var(--s, 1)); color: var(--drive-muted); } +.drive-panel button.drive-panel__wide { grid-area: -2 / 5 / -1 / -1; font-size: calc(17px * var(--s, 1)); font-weight: 700; } .drive-points__search { grid-area: 2 / 1 / 3 / -1; display: flex; align-items: center; padding: 0 10px; } -.drive-points__search input { width: 100%; box-sizing: border-box; height: 60px; padding: 0 16px; border: 1px solid var(--drive-line); border-radius: 8px; background: var(--drive-input); color: var(--band-fg); font-size: 20px; } +.drive-points__search input { width: 100%; box-sizing: border-box; height: calc(60px * var(--s, 1)); padding: 0 16px; border: 1px solid var(--drive-line); border-radius: 8px; background: var(--drive-input); color: var(--band-fg); font-size: calc(20px * var(--s, 1)); } .drive-points__bar, .drive-layers__presets, .drive-layers__source { @@ -4659,7 +4661,7 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea .drive-points__bar { grid-area: 3 / 1 / 4 / -1; } .drive-layers__presets { grid-area: 2 / 1 / 3 / -1; } .drive-layers__source { grid-area: 3 / 4 / 4 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); } -.drive-panel .drive-panel__scope { grid-column: span 2; font-size: 16px; font-weight: 700; } +.drive-panel .drive-panel__scope { grid-column: span 2; font-size: calc(16px * var(--s, 1)); font-weight: 700; } .drive-layers__source .drive-panel__scope { grid-column: auto; } .drive-panel__preset { grid-column: span 2; } .drive-panel__preset, @@ -4668,18 +4670,18 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea .drive-panel .drive-panel__preset[aria-pressed="true"], .drive-panel .drive-panel__mode[aria-pressed="true"] { background: var(--drive-key-on); color: #fff; } .drive-points__path { grid-column: span 5; display: flex; flex-direction: column; justify-content: center; padding: 0 14px; white-space: nowrap; overflow: hidden; } -.drive-points__path b { font-size: 19px; overflow: hidden; text-overflow: ellipsis; } +.drive-points__path b { font-size: calc(19px * var(--s, 1)); overflow: hidden; text-overflow: ellipsis; } .drive-panel .drive-panel__item { grid-column: 1 / -3; display: flex; align-items: center; gap: 12px; padding: 0 14px; } -.drive-points__icon { width: 22px; flex: none; text-align: center; font-size: 20px; } -.drive-points__away { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--drive-muted); font-variant-numeric: tabular-nums; white-space: nowrap; } +.drive-points__icon { width: calc(22px * var(--s, 1)); flex: none; text-align: center; font-size: calc(20px * var(--s, 1)); } +.drive-points__away { margin-left: auto; font-size: calc(15px * var(--s, 1)); font-weight: 600; color: var(--drive-muted); font-variant-numeric: tabular-nums; white-space: nowrap; } .drive-panel .drive-panel__eye { color: var(--drive-muted); } .drive-panel .drive-panel__eye.active { color: var(--drive-eye); } -.drive-panel .drive-panel__open { font-size: 30px; font-weight: 700; } +.drive-panel .drive-panel__open { font-size: calc(30px * var(--s, 1)); font-weight: 700; } .drive-panel .drive-panel__blank { cursor: default; } .drive-layers__map { grid-area: 3 / 1 / 4 / 4; display: flex; flex-direction: column; justify-content: center; padding: 0 14px; white-space: nowrap; overflow: hidden; } -.drive-layers__map span { font-size: 15px; font-weight: 600; color: var(--drive-muted); overflow: hidden; text-overflow: ellipsis; } +.drive-layers__map span { font-size: calc(15px * var(--s, 1)); font-weight: 600; color: var(--drive-muted); overflow: hidden; text-overflow: ellipsis; } .drive-layers__item { grid-column: 1 / -2; display: flex; align-items: center; gap: 12px; padding: 0 14px; } -.drive-layers__icon { width: 24px; height: 24px; flex: none; color: var(--drive-muted); } +.drive-layers__icon { width: calc(24px * var(--s, 1)); height: calc(24px * var(--s, 1)); flex: none; color: var(--drive-muted); } .drive-layers__icon svg { width: 100%; height: 100%; } /* Terrain (drive_menus.js, the canvas' GridTerrain): two dials of 3 × 3.5 @@ -4688,7 +4690,7 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea .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: 232px; min-height: 0; flex: 1; color: var(--band-fg); } +.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); } .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; } @@ -4698,7 +4700,7 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea .drive-terrain__mast { stroke: currentColor; stroke-width: 3; } .drive-terrain__svg .drive-terrain__car { fill: currentColor; } .drive-terrain__svg .drive-terrain__peak { fill: var(--band-fg); opacity: 0.8; } -.drive-terrain__value { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; } +.drive-terrain__value { font-size: calc(44px * 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; } @@ -4707,7 +4709,7 @@ html.driving .dash-banner { display: none; } /* the grid's manoeuvre cell instea .drive-terrain__elevation { grid-area: 6 / 1 / 8 / 8; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 10px 14px; min-height: 0; overflow: hidden; } .drive-panel button.drive-terrain__level, .drive-panel button.drive-terrain__reset, -.drive-panel button.drive-terrain__road { font-size: 17px; font-weight: 700; } +.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; } diff --git a/public/drive/road.json b/public/drive/road.json index 1d1aa58..a1c10ff 100644 --- a/public/drive/road.json +++ b/public/drive/road.json @@ -3,6 +3,7 @@ "screen": "16 × 10 cells (the navigator's 16″, 1280 × 800)", "columns": 16, "rows": 10, + "cell": 80, "map": "2 / 1 / 10 / 14", "menu": { "area": "2 / 10 / 10 / 17", "map": "2 / 1 / 10 / 10" }, "cells": [ diff --git a/public/js/dashboard.js b/public/js/dashboard.js index 864f66d..bc88d6c 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -213,7 +213,7 @@ export class DashboardControl { if (this._values.alt == null) { this._values.alt = await elevationAt(lon, lat, offline, { zoom: TILT_ZOOM, smooth: true }); } - if (this._course == null || this._values.pitch != null || this._values.roll != null) return; + if (this._course == null) return; const [front, back, right, left] = await Promise.all([0, 180, 90, 270].map((b) => at(this._course + b))); if ([front, back, right, left].includes(null)) return; const deg = (rise) => Math.atan(rise / (2 * TILT_HALF_M)) / rad; @@ -391,7 +391,11 @@ export class DashboardControl { this._updateCourse(this._values); this._simRunning = !!data.simulated; // /sim.html runs it this._actions = data.actions || []; // can.json's SDO actions (levelling), POST /api/can/actions/ - if (this._simRunning) await this._simulateTerrain(); + if (this._simRunning) { + // simulated driving: the tilt of the terrain under it, not the IMU of the car standing at home + this._values.pitch = this._values.roll = null; + await this._simulateTerrain(); + } this._navigate(); this._status.textContent = this._simRunning ? "Simulated GNSS" : data.available ? "" : "CAN is off on this server"; this._status.hidden = !this._status.textContent; diff --git a/public/js/driving.js b/public/js/driving.js index 4461571..ca93d4e 100644 --- a/public/js/driving.js +++ b/public/js/driving.js @@ -503,13 +503,26 @@ export function setupDriving(map, nightButton, routePanel, gpxPanel) { fetch(PROFILE_URL, { cache: "no-cache" }).then((r) => r.json()).then((p) => { profile = p; - app.style.setProperty("--drive-cols", p.columns); - app.style.setProperty("--drive-rows", p.rows); + // Cells of p.cell px at most; on a bigger screen only the map's columns + // and rows (beside an open menu) stretch, the rest stays cell-sized. + const [mr1, mc1, mr2, mc2] = p.menu.map.split("/").map(Number); + const track = (n, from, to) => Array.from({ length: n }, (_, i) => (i + 1 >= from && i + 1 < to ? "minmax(0, 1fr)" : "var(--cell)")).join(" "); + // One scale for everything (--s): the cells, the type, the icons — the + // same elements on a 7″ as on the 16″, only smaller; never bigger than drawn. + const fit = () => { + const scale = Math.min(1, window.innerWidth / (p.columns * (p.cell || 80)), window.innerHeight / (p.rows * (p.cell || 80))); + app.style.setProperty("--s", scale.toFixed(3)); + app.style.setProperty("--cell", `${((p.cell || 80) * scale).toFixed(1)}px`); + }; + fit(); + window.addEventListener("resize", fit); + app.style.setProperty("--drive-columns", track(p.columns, mc1, mc2)); + app.style.setProperty("--drive-row-sizes", track(p.rows, mr1, mr2)); app.style.setProperty("--drive-map", openPanel ? p.menu.map : p.map); app.style.setProperty("--drive-menu", p.menu.area); const [r1, c1, r2, c2] = p.menu.area.split("/").map(Number); app.style.setProperty("--drive-menu-cols", c2 - c1); - app.style.setProperty("--drive-menu-rows", r2 - r1); + app.style.setProperty("--drive-menu-mid", r2 - r1 - 4); // the list rows between the 3 on top and the foot for (const cell of p.cells) { const el = make(cell); app.append(el);