diff --git a/starpilot/system/the_galaxy/assets/mobile/css/material.css b/starpilot/system/the_galaxy/assets/mobile/css/material.css index 8a89bb0272..cf9ad1bed1 100644 --- a/starpilot/system/the_galaxy/assets/mobile/css/material.css +++ b/starpilot/system/the_galaxy/assets/mobile/css/material.css @@ -884,8 +884,7 @@ body.is-scrolling .gx-tile { width: 100%; } -.gx-slider-row .gx-row__value { text-align: left; min-width: 0; } -.gx-slider-row .gx-slider-reset { align-self: flex-end; } +.gx-slider-row .gx-row__value { text-align: left; min-width: 0; transition: color var(--motion-fast), text-shadow var(--motion-fast); } .gx-slider-meta { color: var(--text-muted); @@ -903,6 +902,7 @@ input[type="range"].gx-slider { flex: 1; height: 8px; outline: none; + touch-action: pan-y; width: 100%; } @@ -1317,34 +1317,6 @@ button.gx-chip:hover { color: var(--primary); } -.gx-language-card { - margin-bottom: var(--sp-4); -} - -.gx-language-card__row { - align-items: center; - display: flex; - flex-wrap: wrap; - gap: var(--sp-3); -} - -.gx-language-card__label { - align-items: center; - display: flex; - flex: 1 1 360px; - gap: var(--sp-4); - min-width: 220px; -} - -.gx-language-card__select { - margin-left: var(--sp-2); - max-width: 220px; -} - -.gx-language-card__hint { - margin-left: auto; -} - @media (min-width: 768px) { .gx-app.gx-nav-pinned .gx-content { margin-left: 320px; @@ -1357,25 +1329,6 @@ button.gx-chip:hover { } } -@media (max-width: 767px) { - .gx-language-card__label { - flex-basis: 100%; - } - - .gx-language-card__hint { - margin-left: 0; - width: 100%; - } -} - -/* The destination view is a map-first screen. Search and route details float - over the map, matching the classic navigation experience. */ -.gx-navigation-view { - margin: calc(-1 * var(--sp-4)); - min-height: calc(100dvh - var(--appbar-height)); - position: relative; -} - .gx-navigation-stage { background: var(--surface-container-low); min-height: calc(100dvh - var(--appbar-height)); @@ -1423,8 +1376,7 @@ button.gx-chip:hover { .gx-navigation-search, .gx-navigation-summary, -.gx-navigation-recent, -.gx-navigation-error { +.gx-navigation-recent { max-width: min(500px, calc(100vw - 32px)); } @@ -1641,12 +1593,6 @@ button.gx-chip:hover { border-top: 1px solid var(--outline); } -.gx-navigation-error { - color: var(--error); - margin: var(--sp-4) 0 0; - padding: var(--sp-3); -} - .gx-navigation-empty { align-items: center; display: flex; @@ -1664,30 +1610,11 @@ button.gx-chip:hover { margin: 0; } -.gx-navigation-tabs { - pointer-events: auto; - position: absolute; - right: var(--sp-4); - top: var(--sp-4); - z-index: 3; -} - @media (max-width: 767px) { - .gx-navigation-view { - margin: calc(-1 * var(--sp-3)); - } - .gx-navigation-overlay { padding: var(--sp-3); } - .gx-navigation-tabs { - bottom: calc(var(--bottomnav-height) + var(--sp-3)); - left: var(--sp-3); - right: auto; - top: auto; - } - .gx-navigation-summary__rows > div { grid-template-columns: 28px 82px 1fr; } @@ -2446,3 +2373,21 @@ button.gx-chip:hover { .gx-select-menu { background: linear-gradient(var(--surface-container-high), var(--surface-container-high)), #141020; } [data-theme="light"] .gx-select-menu { background: linear-gradient(var(--surface-container-high), var(--surface-container-high)), #fff; } .gx-select-menu:not([open]) { display: none; } + +.gx-slider-row.is-fine-scrubbing input[type="range"].gx-slider { + touch-action: none; + background: rgba(157, 114, 255, 0.28); + box-shadow: 0 0 8px var(--primary-glow); +} + +.gx-slider-row.is-fine-scrubbing input[type="range"].gx-slider::-webkit-slider-thumb { + transform: scale(1.35); + background: var(--secondary); + border-color: #ffffff; + box-shadow: 0 0 10px var(--secondary-glow); +} + +.gx-slider-row.is-fine-scrubbing .gx-row__value { + color: var(--secondary); + text-shadow: 0 0 10px var(--secondary-glow); +} diff --git a/starpilot/system/the_galaxy/assets/mobile/js/app.js b/starpilot/system/the_galaxy/assets/mobile/js/app.js index 3710275dca..b8d5eaad63 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/app.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/app.js @@ -6,7 +6,7 @@ import { Tools } from "./views/Tools.js" import { Recordings } from "./views/Recordings.js" import { Logs } from "./views/Logs.js" import { Tuning } from "./views/Tuning.js" -import { Navigation } from "./views/Navigation.js?v=nav-destination-3" +import { Navigation } from "./views/Navigation.js?v=nav-destination-4" import { Vehicle } from "./views/Vehicle.js" import { Bluetooth } from "./views/Bluetooth.js" import { SystemTools } from "./views/SystemTools.js" diff --git a/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyToggleCard.js b/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyToggleCard.js index 5a36e2ba9c..b7ff563c81 100644 --- a/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyToggleCard.js +++ b/starpilot/system/the_galaxy/assets/mobile/js/components/GalaxyToggleCard.js @@ -9,6 +9,10 @@ import { t } from "../i18n.js" const PANDA_FIRMWARE_TOGGLE_KEYS = new Set(["IgnoreIgnitionLine", "RemoteStartBootsComma", "HKGRemoteStartBootsComma", "TeslaWakeOnCAN"]) +const FINE_SCRUB_HOLD_MS = 300 +const FINE_SCRUB_FACTOR = 5 +const FINE_SCRUB_JITTER_PX = 4 + export const GalaxyToggleCard = { name: "GalaxyToggleCard", components: { FavoritesEditor }, @@ -30,6 +34,8 @@ export const GalaxyToggleCard = { endpointLoading: false, preview: undefined, interacting: false, + fineScrub: null, + isFineScrubbing: false, } }, computed: { @@ -127,19 +133,95 @@ export const GalaxyToggleCard = { if (Math.abs(next - current) <= this.epsilon) return this.commit(next) }, + snap(raw) { + return snapNumericToBoundsAndStep(raw, this.bounds, this.precision) + }, + clearHoldTimer() { + if (this._holdTimer) { + clearTimeout(this._holdTimer) + this._holdTimer = null + } + }, + startHoldTimer() { + this.clearHoldTimer() + if (!this.fineScrub || this.fineScrub.active) return + this._holdTimer = setTimeout(() => { + this.activateFineScrub() + }, FINE_SCRUB_HOLD_MS) + }, + activateFineScrub() { + if (!this.fineScrub || this.fineScrub.active) return + this.fineScrub.active = true + this.fineScrub.baseValue = this.snap(this.currentValue) ?? Number(this.bounds.min) + this.fineScrub.baseX = this.fineScrub.lastX + this.isFineScrubbing = true + try { navigator.vibrate?.(15) } catch (_) {} + }, onSliderInput(e) { + if (this.fineScrub?.active) { + if (this.$refs.slider) this.$refs.slider.value = this.currentValue + return + } this.beginInteract() this.preview = Number(e.target.value) + this.startHoldTimer() }, onSliderCommit(e) { + if (this.fineScrub?.active) return this.interacting = false this.flushSlider(e.target.value) }, onSliderBlur(e) { - if (this.interacting) this.onSliderCommit(e) + if (this.interacting && !this.fineScrub) this.onSliderCommit(e) }, - snap(raw) { - return snapNumericToBoundsAndStep(raw, this.bounds, this.precision) + onSliderPointerDown(e) { + this.beginInteract() + try { e.target.setPointerCapture?.(e.pointerId) } catch (err) {} + const rect = e.target.getBoundingClientRect() + this.fineScrub = { + active: false, + baseValue: this.snap(this.currentValue) ?? Number(this.bounds.min), + baseX: e.clientX, + lastX: e.clientX, + min: Number(this.bounds.min), + max: Number(this.bounds.max), + track: rect.width || 200, + pointerId: e.pointerId, + } + this.startHoldTimer() + }, + onSliderPointerMove(e) { + const scrub = this.fineScrub + if (!scrub) return + + if (!scrub.active) { + if (Math.abs(e.clientX - scrub.lastX) > FINE_SCRUB_JITTER_PX) { + scrub.lastX = e.clientX + this.startHoldTimer() + } + return + } + + e.preventDefault() + if (!Number.isFinite(scrub.min) || !Number.isFinite(scrub.max) || !Number.isFinite(scrub.track) || scrub.track <= 0) return + const totalSpan = scrub.max - scrub.min + const dx = e.clientX - scrub.baseX + const raw = scrub.baseValue + (dx * totalSpan) / scrub.track / FINE_SCRUB_FACTOR + const next = this.snap(raw) + if (next === null) return + this.preview = next + if (this.$refs.slider) this.$refs.slider.value = next + }, + onSliderPointerEnd(e) { + this.clearHoldTimer() + const wasFine = this.isFineScrubbing + this.fineScrub = null + this.isFineScrubbing = false + try { e.target.releasePointerCapture?.(e.pointerId) } catch (_) {} + this.interacting = false + if (wasFine || this.preview !== undefined) { + this.flushSlider(this.currentValue) + } }, async resetToDefault() { const defaults = await api.getDefaults() @@ -183,6 +265,9 @@ export const GalaxyToggleCard = { mounted() { if (this.param.options_endpoint) this.loadEndpointOptions() }, + unmounted() { + this.clearHoldTimer() + }, template: `