diff --git a/openpilot/starpilot/galaxy/web/css/navigation.css b/openpilot/starpilot/galaxy/web/css/navigation.css index 7dc67e827d..9e50eb8fb8 100644 --- a/openpilot/starpilot/galaxy/web/css/navigation.css +++ b/openpilot/starpilot/galaxy/web/css/navigation.css @@ -148,8 +148,8 @@ /* Setup choices: compact M3 choice buttons with an expandable info popover. */ .gx-choice { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--sp-2); } .gx-choice__head { display: flex; align-items: center; gap: var(--sp-2); } -.gx-choice__legend { padding: 0; font-weight: var(--fw-medium); float: left; } -.gx-choice__info-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; min-height: 32px !important; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: .95rem; cursor: pointer; transition: background var(--motion-fast), color var(--motion-fast); } +.gx-choice__legend { font-weight: var(--fw-medium); } +.gx-choice__info-btn { color: var(--text-muted); font-size: .95rem; } .gx-choice__info-btn:hover, .gx-choice__info-btn[aria-expanded="true"] { background: var(--surface-container-high); color: var(--primary); } .gx-choice__hint { margin: 0; color: var(--text-muted); font-size: .85rem; } .gx-choice__grid { display: flex; flex-wrap: wrap; gap: var(--sp-2); } @@ -166,7 +166,7 @@ .gx-choice__active-summary { margin: 0; color: var(--text-muted); font-size: .83rem; line-height: 1.4; } .gx-choice__popover { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--outline); border-radius: var(--radius-md); background: var(--surface-container-high, var(--surface-container)); font-size: .85rem; } .gx-choice__popover-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); } -.gx-choice__popover-close { display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 28px !important; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; } +.gx-choice__popover-close { color: var(--text-muted); } .gx-choice__popover-close:hover { background: var(--glass-active-bg); color: var(--on-surface); } .gx-choice__popover-list { margin: 0; display: grid; gap: var(--sp-2); } .gx-choice__popover-item { display: grid; gap: 2px; padding-top: var(--sp-2); border-top: 1px solid var(--outline); } diff --git a/openpilot/starpilot/galaxy/web/js/navigation-setup.js b/openpilot/starpilot/galaxy/web/js/navigation-setup.js index 77b4cbf3ae..a59d7491f8 100644 --- a/openpilot/starpilot/galaxy/web/js/navigation-setup.js +++ b/openpilot/starpilot/galaxy/web/js/navigation-setup.js @@ -15,10 +15,10 @@ export const ChoiceGroup = { }, }, template: ` -
+
- {{ label }} - @@ -40,7 +40,7 @@ export const ChoiceGroup = {
{{ label }} options -
@@ -54,9 +54,9 @@ export const ChoiceGroup = {
`, } -// What each service does and where it stops. Mapbox always does search and offline roads. +// Provider capabilities and limits. export const COMPARE_ROWS = [ - ["Place search and addresses", "Yes", "No, Mapbox does this"], + ["Place search and addresses", "Yes", "Yes, when Google gives directions; Mapbox is the fallback"], ["Offline road maps", "Yes", "No, Google tiles can't be saved"], ["Lane arrows on the turn card", "Yes", "No"], ["Traffic in route times", "Yes", "Yes, with a correction every 7½ minutes"], diff --git a/openpilot/starpilot/navigation/route_engine.py b/openpilot/starpilot/navigation/route_engine.py index c02547647d..bf9958fae4 100644 --- a/openpilot/starpilot/navigation/route_engine.py +++ b/openpilot/starpilot/navigation/route_engine.py @@ -73,7 +73,8 @@ def simplify(points, limit: int = PREVIEW_POINTS, tolerance: float = PREVIEW_TOL if length < 1e-9: deviation = np.hypot(*(inner - a).T) else: - deviation = np.abs(direction[0] * (inner[:, 1] - a[1]) - direction[1] * (inner[:, 0] - a[0])) / length + fraction = np.clip((inner - a) @ direction / length ** 2, 0., 1.) + deviation = np.hypot(*(inner - (a + fraction[:, None] * direction)).T) index = int(np.argmax(deviation)) if deviation[index] <= tolerance: continue diff --git a/openpilot/starpilot/navigation/tests/test_route_runtime.py b/openpilot/starpilot/navigation/tests/test_route_runtime.py index 37e9e84994..46d7588a9d 100644 --- a/openpilot/starpilot/navigation/tests/test_route_runtime.py +++ b/openpilot/starpilot/navigation/tests/test_route_runtime.py @@ -544,6 +544,11 @@ def test_route_line_keeps_corners_and_thins_straight_road(): assert len(simplify(wiggle)) == PREVIEW_POINTS +def test_route_line_preserves_a_collinear_turnaround(): + from openpilot.starpilot.navigation.route_engine import simplify + assert simplify([(0., 0.), (.01, 0.), (.005, 0.)]) == [0, 1, 2] + + def garage_runtime(tmp_path, monkeypatch): monkeypatch.setattr(NavigationOwner, '_is_metric', lambda self: True) owner = NavigationOwner(tmp_path, runtime_source=lambda: None)