From 88637ded22f52c806ec217887ef9fad1d1cb561d Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 7 Sep 2026 20:37:43 +0200 Subject: [PATCH] Move the locate-me button into the top-left control stack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- docs/architecture.adoc | 13 +++++++------ public/js/map.js | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/architecture.adoc b/docs/architecture.adoc index 4fd8f07..765e3ea 100644 --- a/docs/architecture.adoc +++ b/docs/architecture.adoc @@ -141,15 +141,16 @@ sits top-left on the map, pinned to `CENTER`/`ZOOM` explicitly rather than its own fallback (the view at construction time, which would just be wherever a loaded permalink happened to point). It resets to the app's default view, not the visitor's own location — that's -`GeolocateControl`, a separate button at bottom-right. +`GeolocateControl`, a separate button in the same stack (below). That Home button is the top of a small top-left stack — Home, zoom in/out (`NavigationControl`, `showCompass: false` since this map never -rotates), and a "Base map" button — matching the National Park -Service's own map control layout (grouped together on the map itself, -rather than split between the map and a side panel). The last of -those, `MapLayersButton` (`public/js/map.js`), is a second entry point -into the exact same Online/Offline panel `LayerToggleControl` already +rotates), locate-me (`GeolocateControl`), and a "Base map" button — +matching the National Park Service's own map control layout (grouped +together on the map itself, rather than split across corners or +between the map and a side panel). The last of those, +`MapLayersButton` (`public/js/map.js`), is a second entry point into +the exact same Online/Offline panel `LayerToggleControl` already manages in the page's own sidebar — both call the same `LayerToggleControl#toggle()`, so there's one source of truth for the panel's open/closed state either way. diff --git a/public/js/map.js b/public/js/map.js index 8b2ceca..1ec1431 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -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");