From ae5c04c533db32f5a3673202edceff4dc50da692 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 24 Jan 2021 17:00:28 +1100 Subject: [PATCH] zoom out more on mobile Mobile screens are likely narrower (portrait) so zooming out a little more shows an equivalent width for the Australian continent. --- website/load-map.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/load-map.js b/website/load-map.js index f34485a..7fdaa62 100644 --- a/website/load-map.js +++ b/website/load-map.js @@ -13,6 +13,8 @@ const mechanics = fetch('data/mechanics_institute_locations.csv') const nslaBranches = fetch('data/nsla_library_locations.csv') .then( response => response.text()); +var isSmallScreen = window.screen.availWidth < 800; + Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) .then( data => { // add tile layer from OSM @@ -37,7 +39,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) // attach map to #mapid div above and centre const map = L.map('mapid', { center: [-27.00, 133.000], - zoom: 5, + zoom: isSmallScreen ? 4 : 5, layers: [baseMap] }); @@ -320,7 +322,6 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) } // add control layers - var isSmallScreen = window.screen.availWidth < 800; var mapControl = L.control.layers( baseMaps, overlayMaps,