From 254e9b4c6169b4041be8032b32c2a3d044df1611 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Thu, 10 Sep 2026 22:14:40 +0200 Subject: [PATCH] Add a scale bar to the map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MapLibre's own ScaleControl, bottom-left (attribution already owns bottom-right) — no custom NPS-style bar needed, the built-in one covers it. --- public/js/map.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/js/map.js b/public/js/map.js index 13bd015..43cdf74 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -2,6 +2,7 @@ import { Map as MaplibreMap, NavigationControl, Popup, + ScaleControl, addProtocol, } from "/vendor/maplibre-gl/maplibre-gl.mjs"; 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 // receiver happens to have a fix. See locate.js. 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 // own overview plugin (docs/nps-resources.adoc's "overview" entry, still on