From 8f0e47f48bd732eee3a825dd6626fd3a759b1985 Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Thu, 18 Apr 2019 22:04:44 -0400 Subject: bug fix for initial load without any points --- web/public/javascripts/map.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'web/public/javascripts/map.js') diff --git a/web/public/javascripts/map.js b/web/public/javascripts/map.js index 3f1f040..1f18e09 100644 --- a/web/public/javascripts/map.js +++ b/web/public/javascripts/map.js @@ -169,6 +169,7 @@ function closeDetails(e) { else if (currPoint.feature.geometry.status === "new") { currPoint._icon.src = '../images/blue-icon.png'; } + map.fitBounds(latlngbounds.pad(0.20)); } // returns a Promise object @@ -201,7 +202,10 @@ L.tileLayer('https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r} // map to fit them all var latlngbounds = new L.latLngBounds(); -plotPointsOnMap(points); +if (points.length) { + plotPointsOnMap(points); +} +// setup live updates if (window.EventSource) { var source = new EventSource('/stream'); -- cgit v1.2.3