fixed middle markers stay on marker deletion

This commit is contained in:
muerwre 2019-02-07 16:42:38 +07:00
parent 8a90c50352
commit bb661b976b
5 changed files with 11 additions and 10 deletions

View file

@ -435,13 +435,14 @@ L.Polyline.polylineEditor = L.Polyline.extend({
if (!this._markers || this._markers.length <= 2) return;
if (this.constr.is_drawing) return;
if (_marker.newPointMarker) {
this._map.removeLayer(_marker.newPointMarker);
}
this._map.removeLayer(_marker);
// that._map.removeLayer(newPointMarker);
this._markers.splice(_pointNo, 1);
this._reloadPolyline(_pointNo);
if (this._options.onPointAdded) this._options.onPointAdded(event, 'dropped');
if (this._options.onPointDropped) this._options.onPointDropped(event, 'dropped');
});
// marker.on(that._options.addFirstLastPointEvent, (event) => {
@ -583,8 +584,6 @@ L.Polyline.polylineEditor = L.Polyline.extend({
return;
}
if (this._options.onPointAdded) this._options.onPointAdded(event);
const pointNo = (this._markers && this._markers.length) || 0;
this._addMarkers(pointNo, event.latlng, true);
@ -592,6 +591,8 @@ L.Polyline.polylineEditor = L.Polyline.extend({
this._map.off('click', this._addPointForward);
if (this._options.onPointAdded) this._options.onPointAdded(event);
setTimeout(this._prepareForNewPoint.bind(this), 25);
};