@@ -55,10 +55,10 @@ L.Polyline.plotter = L.Polyline.extend({
55
55
}
56
56
} ,
57
57
_bindMapClick : function ( ) {
58
- this . _map . on ( 'click' , this . _addNewMarker , this ) ;
58
+ this . _map . on ( 'click' , this . _onMapClick , this ) ;
59
59
} ,
60
60
_unbindMapClick : function ( ) {
61
- this . _map . off ( 'click' , this . _addNewMarker , this ) ;
61
+ this . _map . off ( 'click' , this . _onMapClick , this ) ;
62
62
} ,
63
63
_setExistingLatLngs : function ( latlngs ) {
64
64
this . _existingLatLngs = latlngs ;
@@ -97,11 +97,14 @@ L.Polyline.plotter = L.Polyline.extend({
97
97
this . _lineMarkers . splice ( this . _lineMarkers . indexOf ( e . target ) , 1 ) ;
98
98
this . _replot ( ) ;
99
99
} ,
100
+ _onMapClick : function ( e ) {
101
+ this . _addNewMarker ( e ) ;
102
+ this . _replot ( ) ;
103
+ } ,
100
104
_addNewMarker : function ( e ) {
101
105
var newMarker = this . _getNewMarker ( e . latlng , { icon : this . _editIcon } ) ;
102
106
this . _addToMapAndBindMarker ( newMarker ) ;
103
107
this . _lineMarkers . push ( newMarker ) ;
104
- this . _replot ( ) ;
105
108
} ,
106
109
_redrawHalfwayPoints : function ( ) {
107
110
for ( index in this . _halfwayPointMarkers ) {
@@ -139,6 +142,7 @@ L.Polyline.plotter = L.Polyline.extend({
139
142
)
140
143
} ) ;
141
144
}
145
+ this . _replot ( ) ;
142
146
} ,
143
147
_redraw : function ( ) {
144
148
this . setLatLngs ( [ ] ) ;
0 commit comments