diff options
| author | Kumar Damani <damani.kumar@gmail.com> | 2019-04-19 02:05:29 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-19 02:05:29 +0000 |
| commit | 117cfde17d30f01b44bc5a3671927fa998786448 (patch) | |
| tree | 09d41e48e667681a523cb2953c823a57dd890723 | |
| parent | 912609ca035415d40b400fa6fe9988f2ebae3f18 (diff) | |
| parent | 8f0e47f48bd732eee3a825dd6626fd3a759b1985 (diff) | |
Merge pull request #75 from csc301-winter-2019/web-homepage
bug fix for initial load without any points
| -rw-r--r-- | web/public/javascripts/map.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/web/public/javascripts/map.js b/web/public/javascripts/map.js index a121e75..a3d2fb3 100644 --- a/web/public/javascripts/map.js +++ b/web/public/javascripts/map.js @@ -170,6 +170,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 @@ -202,7 +203,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'); |
