nakarte

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

commit 8948448e0b2bf0ca4802f8aaca1600de0f97804f
parent ad9f3cc6a210828c3f36f33369427b5f2a7da166
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Mon, 13 Mar 2017 22:26:12 +0300

[track edit] fixed error when adding poin after deleting all points

Diffstat:
Msrc/lib/leaflet.polyline-edit/index.js | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/lib/leaflet.polyline-edit/index.js b/src/lib/leaflet.polyline-edit/index.js @@ -216,10 +216,13 @@ L.Polyline.EditMixin = { }, makeSegmentOverlay: function(nodeIndex) { - var latlngs = this.getLatLngs(), + const latlngs = this.getLatLngs(), p1 = latlngs[nodeIndex], - p2 = latlngs[nodeIndex + 1], - segmentOverlay = L.polyline([p1, p2], {weight: 10, opacity: 0.0}); + p2 = latlngs[nodeIndex + 1]; + if (!p2) { + return; + } + const segmentOverlay = L.polyline([p1, p2], {weight: 10, opacity: 0.0}); segmentOverlay.on('mousedown', this.onSegmentMouseDownAddNode, this); segmentOverlay.on('contextmenu', function(e) { this.stopDrawingLine();