aboutsummaryrefslogtreecommitdiff
path: root/web/public
diff options
context:
space:
mode:
authorKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-19 02:04:44 +0000
committerKumar Damani <kumar.damani@mail.utoronto.ca>2019-04-19 02:04:44 +0000
commit8f0e47f48bd732eee3a825dd6626fd3a759b1985 (patch)
tree0d6e154768e941105ecc9387a6643c8397ae317b /web/public
parent14f3642f1ea4d32c17d56ffebf5cfd14fb5f5f2c (diff)
bug fix for initial load without any points
Diffstat (limited to 'web/public')
-rw-r--r--web/public/javascripts/map.js6
1 files changed, 5 insertions, 1 deletions
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');