aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-14 04:10:04 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-14 04:14:17 +0100
commit45612b34682aaab64134fa4dd5acf2577fc372e6 (patch)
tree59e4bd4a12b7757d48b17ffe6b11bad71e5da587
parent4746a852ec0617561b4a211954a14db2f886bda0 (diff)
Shorten scale bar on smaller screens.
-rw-r--r--main.js2
1 files changed, 2 insertions, 0 deletions
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');