From 45612b34682aaab64134fa4dd5acf2577fc372e6 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 14 Jan 2024 04:10:04 +0100 Subject: Shorten scale bar on smaller screens. --- main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.js b/main.js index ba799f1..a5883de 100644 --- a/main.js +++ b/main.js @@ -171,9 +171,11 @@ map.getViewport().appendChild(container); /* scale line */ (function() { + const size = map.getSize(); const control = new ScaleLine({ units: 'metric', minWidth: 150, + maxWidth: size[1] < 350 ? size[1] - 50 : 350, target: container, }); control.element.classList.add('modal', 'modal-content'); -- cgit v1.2.3