From 21a7a4b0906da5858c79d56855f25d9fed5a4ac7 Mon Sep 17 00:00:00 2001 From: acr Date: Mon, 27 Mar 2017 16:08:05 +0200 Subject: [PATCH] On screen smaller than 768 width, center the map on eastcoast --- app/assets/js/atlas.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/js/atlas.js b/app/assets/js/atlas.js index 63b7252..6917c2a 100644 --- a/app/assets/js/atlas.js +++ b/app/assets/js/atlas.js @@ -88,10 +88,18 @@ export default class Atlas extends React.Component { loader.remove(); }); + let initialLatLng = []; + + if(window.innerWidth < 768) { + initialLatLng = [40, -75]; + }else{ + initialLatLng = [40, -45]; + } + this.map = L.mapbox.map('map', 'mapbox.dark', { minZoom: 3.5, zoomControl: false - }).setView([40, -45], 3); + }).setView(initialLatLng, 3.5); new L.Control.Zoom({ position: 'topright' }).addTo(this.map);