Give the browser-location fallback its own (blue) marker color
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:
1 parent
6e5676c890
commit
f0ac8ac5d4
2 files changed
+18
-1
No files matched your search
@@ -251,6 +251,16 @@ Locate fall back to the browser's own
|
||||
mechanism — with its own toggle/marker/recentering-per-fix, since
|
||||
that's the one case this control does own the tracking itself;
|
||||
clicking again in that case stops the watch and removes the marker.
|
||||
Deliberately *not* `.gnss-marker` (`GnssControl`'s green dot) for that
|
||||
marker — reusing it for a browser-estimated position too made it look
|
||||
like this control was somehow still using GNSS data even when it very
|
||||
much wasn't (a real report from testing this: a browser's own
|
||||
location, wifi/IP-estimated on a machine with no GPS chip, can jump
|
||||
around noticeably between updates, and a green dot doing that reads
|
||||
as "the GNSS simulator, leaking somehow"). Uses MapLibre's own blue
|
||||
pulsing `.maplibregl-user-location-dot` (`maplibre-gl.css`) instead —
|
||||
the same look GeolocateControl itself had here before, and visually
|
||||
distinct from GNSS's green on purpose.
|
||||
|
||||
=== Debug inspector (Alt+click)
|
||||
|
||||
|
||||
+8
-1
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user