Provide oldLatLng during marker dragging (#4752)

* Provide oldLatLng during dragging

References #4736

* Store temporary _oldLatLng on MarkerDrag not _marker
This commit is contained in:
Steve 2016-08-02 10:40:28 -05:00 committed by Vladimir Agafonkin
parent d411c09fde
commit 3d2b92af82

View File

@ -60,6 +60,8 @@ L.Handler.MarkerDrag = L.Handler.extend({
// @event movestart: Event
// Fired when the marker starts moving (because of dragging).
this._oldLatLng = this._marker.getLatLng();
this._marker
.closePopup()
.fire('movestart')
@ -79,6 +81,7 @@ L.Handler.MarkerDrag = L.Handler.extend({
marker._latlng = latlng;
e.latlng = latlng;
e.oldLatLng = this._oldLatLng;
// @event drag: Event
// Fired repeatedly while the user drags the marker.
@ -93,6 +96,7 @@ L.Handler.MarkerDrag = L.Handler.extend({
// @event moveend: Event
// Fired when the marker stops moving (because of dragging).
delete this._oldLatLng;
this._marker
.fire('moveend')
.fire('dragend', e);