Move the locate-me button into the top-left control stack
CI / check (push) Successful in 42s
CI / deploy (push) Successful in 16s

GeolocateControl was alone at bottom-right while Home/zoom/base-map were
grouped top-left — split across two corners instead of one stack like
the National Park Service's own map controls. Moved it in, between zoom
and the base-map button.
This commit is contained in:
randy committed 2026-09-07 20:37:43 +02:00
1 parent 8fa3391c6b
commit 88637ded22
2 files changed
+19 -18

No files matched your search

+12 -12
View File
@@ -195,17 +195,9 @@ const map = new MaplibreMap({
hash: "map",
});
map.addControl(
new GeolocateControl({
positionOptions: { enableHighAccuracy: true },
trackUserLocation: true,
showAccuracyCircle: true,
}),
"bottom-right",
);
// A compact top-left stack — Home, zoom, base map — matching the National
// Park Service's own map control layout. Added in this order since
// A compact top-left stack — Home, zoom, locate-me, base map — matching
// the National Park Service's own map control layout, all grouped
// together rather than split across corners. Added in this order since
// MapLibre stacks same-position controls in add order.
//
// homePosition/zoom pinned to the app's own default rather than left to the
@@ -214,11 +206,19 @@ map.addControl(
// "current view" and "the default view" are no longer the same thing, and
// a home button that resets to wherever you happened to load the page
// wouldn't be a home button. This is *not* "go to my location" — that's
// GeolocateControl, above.
// GeolocateControl, below.
map.addControl(new HomeButton({ homePosition: CENTER, zoom: ZOOM }), "top-left");
// showCompass: false — this map never rotates, so a bearing-reset button
// (NavigationControl's default third button) would just be dead weight.
map.addControl(new NavigationControl({ showCompass: false }), "top-left");
map.addControl(
new GeolocateControl({
positionOptions: { enableHighAccuracy: true },
trackUserLocation: true,
showAccuracyCircle: true,
}),
"top-left",
);
const sidebar = document.getElementById("sidebar");