From 23e2da9fbf6569e9ec5cee322e3c6b232d3cc065 Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Sat, 25 Jan 2025 21:49:56 +0100 Subject: [PATCH] add scale --- index.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/index.html b/index.html index fb58111..d93a55e 100644 --- a/index.html +++ b/index.html @@ -512,6 +512,27 @@ center: [14.436035, 50.078292], }); map.showTileBoundaries = false; + + // Add scale control with inverted colors + const scale = new maplibregl.ScaleControl({ + maxWidth: 80, + unit: 'metric' + }); + + // Add custom CSS for the scale control + const style = document.createElement('style'); + style.textContent = ` + .maplibregl-ctrl.maplibregl-ctrl-scale { + background-color: rgba(0,0,0,0.5); + color: #ffffff; + border: 1px solid #ffffff; + border-top: none; + } + `; + document.head.appendChild(style); + map.addControl(scale); + + map.on('load', function () { map.addSource('buildings-source', { type: 'vector',