Dead reckoning in a tunnel: no fix for 3 s (or mode < 2) on the trip's route, the position carried along it (estimated: true, a grey arrow) by the car's CAN speed (vehicle.speed) when there is one, the average speed of the last ~20 s otherwise, up to 10 min (App.gnss_position, TripStore.ahead)
This commit is contained in:
1 parent
7fdc0114e6
commit
7204355510
8 files changed
+143
-18
No files matched your search
+5
-6
@@ -1,5 +1,5 @@
|
||||
import { Marker } from "/vendor/maplibre-gl/maplibre-gl.mjs";
|
||||
import { followPosition } from "/js/gnss.js";
|
||||
import { followPosition, startFollow } from "/js/gnss.js";
|
||||
|
||||
// Replaces MapLibre's own GeolocateControl (browser Geolocation API only)
|
||||
// with one that prefers this app's own GNSS receiver when it's turned on
|
||||
@@ -96,7 +96,7 @@ export class LocateControl {
|
||||
_jumpToGnss({ alertIfNoFix = false } = {}) {
|
||||
const position = this._gnssControl.getPosition();
|
||||
if (position) {
|
||||
this._map.flyTo({ center: position, zoom: Math.max(this._map.getZoom(), 15) });
|
||||
startFollow(this._map, position);
|
||||
} else if (alertIfNoFix) {
|
||||
window.alert("Waiting for a GNSS fix…");
|
||||
}
|
||||
@@ -118,10 +118,9 @@ export class LocateControl {
|
||||
}
|
||||
|
||||
// Recenters on every fix, following the position the way GeolocateControl
|
||||
// itself does while tracking — flyTo (with its zoom swoop) only for the
|
||||
// itself does while tracking — startFollow (zooming in) only for the
|
||||
// first fix, since that's the one jumping from wherever the map already
|
||||
// was; easeTo for later updates, a plain pan/zoom-preserving follow
|
||||
// rather than repeating that same swoop on every update.
|
||||
// was; a plain follow zooming by the speed (autoZoom) for later updates.
|
||||
//
|
||||
// MapLibre's own blue pulsing "user location" dot styling
|
||||
// (.maplibregl-user-location-dot, maplibre-gl.css — the exact look
|
||||
@@ -138,7 +137,7 @@ export class LocateControl {
|
||||
const circleEl = document.createElement("div");
|
||||
circleEl.className = "maplibregl-user-location-accuracy-circle";
|
||||
this._circleMarker = new Marker({ element: circleEl, pitchAlignment: "map" }).setLngLat([lon, lat]).addTo(this._map);
|
||||
this._map.flyTo({ center: [lon, lat], zoom: Math.max(this._map.getZoom(), 15) });
|
||||
startFollow(this._map, [lon, lat]);
|
||||
} else {
|
||||
this._marker.setLngLat([lon, lat]);
|
||||
this._circleMarker.setLngLat([lon, lat]);
|
||||
|
||||
Reference in new issue
Block a user