Home button fits all of Slovakia; add an overview map, top-right
CI / check (push) Successful in 1m33s
CI / deploy (push) Successful in 27s

Home now fitBounds()s a country-wide bbox instead of resetting to
CENTER/ZOOM's Bratislava point, since Home resetting into the same
city you'd already be looking at wasn't useful.

The overview map is NPS's own overview plugin (npmap5-plugins, still
on an unmerged branch), vendored and converted from its UMD dist
build to a plain ES module. Patched one MapLibre API break found while
verifying it: the plugin reads map.transform (public in the MapLibre
~2.4 it targets) to relax the inset's polar pan limit; MapLibre 6 (this
app's vendored version) no longer exposes .transform at all, so it
threw on load. Guarded to skip that cosmetic adjustment when absent
instead.
This commit is contained in:
randy committed 2026-09-07 22:30:56 +02:00
1 parent ddf2ee4990
commit 96065b1237
7 files changed
+441 -31

No files matched your search

+29 -15
View File
@@ -137,26 +137,40 @@ Now that any view can be the starting one (via that permalink), a way
back to the app's actual default is worth having: a "Home" button
(`public/vendor/npmap-home-button/`, the National Park Service's own
`home-button` MapLibre control — see `docs/third-party-notices.adoc`)
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 in the same stack (below).
sits top-left on the map. It fits to `SLOVAKIA_BOUNDS` (a country-wide
bounding box) rather than the plain `CENTER`/`ZOOM` point the map
itself starts at — "home" is meant as a full-country overview, not a
re-centering on Bratislava. It resets to that fixed default view, not
the visitor's own location — that's `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), a passive zoom-level readout (`ZoomLevelControl`, a plain div
updated on the map's `zoom` event — not a button, since it has no
click behavior of its own), 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.
click behavior of its own), a distance/area measuring tool
(`MeasureControl`, `public/js/measure.js`), 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.
A separate control sits top-right: a small inset overview map
(`public/vendor/npmap-overview/`, NPS's `overview` plugin — see
`docs/nps-resources.adoc`) showing the current view's location in a
wider, zoomed-out context, with the visible area drawn as a box on top
of it; dragging that box pans the main map. It clones whichever base
style the main map is currently showing (`style: ''`, its own default —
the plugin reads `map.style.serialize()`) rather than a separate style
of its own, so it stays visually consistent with the Online/Offline
toggle without this app maintaining a second style for it. Vendored
from an unmerged upstream branch and patched for a MapLibre API break
(it targeted MapLibre ~2.4's public `map.transform`, since removed) —
see `docs/third-party-notices.adoc` for the exact patch.
=== Debug inspector (Alt+click)