Add a scale bar to the map
MapLibre's own ScaleControl, bottom-left (attribution already owns bottom-right) — no custom NPS-style bar needed, the built-in one covers it.
This commit is contained in:
1 parent
c9561a5489
commit
254e9b4c61
1 file changed
+2
@@ -2,6 +2,7 @@ import {
|
|||||||
Map as MaplibreMap,
|
Map as MaplibreMap,
|
||||||
NavigationControl,
|
NavigationControl,
|
||||||
Popup,
|
Popup,
|
||||||
|
ScaleControl,
|
||||||
addProtocol,
|
addProtocol,
|
||||||
} from "/vendor/maplibre-gl/maplibre-gl.mjs";
|
} from "/vendor/maplibre-gl/maplibre-gl.mjs";
|
||||||
import { GpxPanelControl } from "/js/gpx.js";
|
import { GpxPanelControl } from "/js/gpx.js";
|
||||||
@@ -427,6 +428,7 @@ const gnssControl = new GnssControl(map);
|
|||||||
// the "GNSS" sidebar icon actually turns it on — not just whenever a
|
// the "GNSS" sidebar icon actually turns it on — not just whenever a
|
||||||
// receiver happens to have a fix. See locate.js.
|
// receiver happens to have a fix. See locate.js.
|
||||||
map.addControl(new LocateControl(gnssControl), "top-left");
|
map.addControl(new LocateControl(gnssControl), "top-left");
|
||||||
|
map.addControl(new ScaleControl({ unit: "metric" }), "bottom-left");
|
||||||
|
|
||||||
// A small inset map showing where the current view sits in context — NPS's
|
// A small inset map showing where the current view sits in context — NPS's
|
||||||
// own overview plugin (docs/nps-resources.adoc's "overview" entry, still on
|
// own overview plugin (docs/nps-resources.adoc's "overview" entry, still on
|
||||||
|
|||||||
Reference in new issue
Block a user