nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit e1819d8594f5cc577596c23acaea865ac84db4f7
parent 4e6e832e6ebb5fe5f0c0aee8827bd7d1413064a7
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Sun, 27 Nov 2016 03:37:44 +0300

[track list] do not try to pan to track without nodes

Diffstat:
Msrc/lib/leaflet.control.track-list/track-list.js | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js @@ -329,14 +329,18 @@ L.Control.TrackList = L.Control.extend({ if (lines.length || points.length) { var bounds = L.latLngBounds([]); lines.forEach(function(l) { - bounds.extend(l.getBounds()); + if (l.getLatLngs().length > 1) { + bounds.extend(l.getBounds()); + } } ); points.forEach(function(p) { bounds.extend([p.latlng.lat, p.latlng.lng]); } ); - this.map.flyToBounds(bounds); + if (bounds.isValid()) { + this.map.flyToBounds(bounds); + } } },