Give the browser-location fallback its own (blue) marker color
CI / check (push) Successful in 50s
CI / deploy (push) Successful in 25s

The browser-geolocation fallback was reusing GnssControl's green
.gnss-marker for its own position dot -- on a machine with no real GPS
chip, wifi/IP-estimated location can jump around noticeably between
watchPosition updates, and a green dot doing that reads as "GNSS is
somehow still being used" even when it very much isn't (confirmed:
code review found no path from locate.js to /api/gnss/position at
all, and GNSS was off in the report). Switched to MapLibre's own blue
pulsing .maplibregl-user-location-dot -- the same look GeolocateControl
itself had here before, and now visually distinct from GNSS's green
on purpose rather than by accident.

Verified: both markers rendered side by side (GNSS on via the
simulator, plus a manually-placed browser-fallback-style marker) --
clearly different colors, no shared styling.
This commit is contained in:
randy committed 2026-09-08 08:04:31 +02:00
1 parent 6e5676c890
commit f0ac8ac5d4
2 files changed
+18 -1

No files matched your search

+8 -1
View File
@@ -89,10 +89,17 @@ export class LocateControl {
// 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.
//
// MapLibre's own blue pulsing "user location" dot styling
// (.maplibregl-user-location-dot, maplibre-gl.css — the exact look
// GeolocateControl itself used here before), not GnssControl's green
// .gnss-marker — reusing that green for a browser-estimated position too
// looked like this control was somehow still using GNSS data even when
// it very much wasn't; distinct colors for distinct sources.
_setPosition(lon, lat) {
if (!this._marker) {
const el = document.createElement("div");
el.className = "gnss-marker";
el.className = "maplibregl-user-location-dot";
this._marker = new Marker({ element: el }).setLngLat([lon, lat]).addTo(this._map);
this._map.flyTo({ center: [lon, lat], zoom: Math.max(this._map.getZoom(), 15) });
} else {