Merge pull request #3264 from yohanboniface/drag-original-event
Forward original event on drag
This commit is contained in:
commit
f27ead251a
@ -104,13 +104,15 @@ L.Draggable = L.Evented.extend({
|
|||||||
this._moving = true;
|
this._moving = true;
|
||||||
|
|
||||||
L.Util.cancelAnimFrame(this._animRequest);
|
L.Util.cancelAnimFrame(this._animRequest);
|
||||||
|
this._lastEvent = e;
|
||||||
this._animRequest = L.Util.requestAnimFrame(this._updatePosition, this, true, this._dragStartTarget);
|
this._animRequest = L.Util.requestAnimFrame(this._updatePosition, this, true, this._dragStartTarget);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePosition: function () {
|
_updatePosition: function () {
|
||||||
this.fire('predrag');
|
var e = {originalEvent: this._lastEvent};
|
||||||
|
this.fire('predrag', e);
|
||||||
L.DomUtil.setPosition(this._element, this._newPos);
|
L.DomUtil.setPosition(this._element, this._newPos);
|
||||||
this.fire('drag');
|
this.fire('drag', e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUp: function () {
|
_onUp: function () {
|
||||||
|
@ -46,7 +46,7 @@ L.Handler.MarkerDrag = L.Handler.extend({
|
|||||||
.fire('dragstart');
|
.fire('dragstart');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDrag: function () {
|
_onDrag: function (e) {
|
||||||
var marker = this._marker,
|
var marker = this._marker,
|
||||||
shadow = marker._shadow,
|
shadow = marker._shadow,
|
||||||
iconPos = L.DomUtil.getPosition(marker._icon),
|
iconPos = L.DomUtil.getPosition(marker._icon),
|
||||||
@ -58,10 +58,11 @@ L.Handler.MarkerDrag = L.Handler.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
marker._latlng = latlng;
|
marker._latlng = latlng;
|
||||||
|
e.latlng = latlng;
|
||||||
|
|
||||||
marker
|
marker
|
||||||
.fire('move', {latlng: latlng})
|
.fire('move', e)
|
||||||
.fire('drag');
|
.fire('drag', e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function (e) {
|
_onDragEnd: function (e) {
|
||||||
|
@ -63,7 +63,7 @@ L.Map.Drag = L.Handler.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDrag: function () {
|
_onDrag: function (e) {
|
||||||
if (this._map.options.inertia) {
|
if (this._map.options.inertia) {
|
||||||
var time = this._lastTime = +new Date(),
|
var time = this._lastTime = +new Date(),
|
||||||
pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
|
pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
|
||||||
@ -78,8 +78,8 @@ L.Map.Drag = L.Handler.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._map
|
this._map
|
||||||
.fire('move')
|
.fire('move', e)
|
||||||
.fire('drag');
|
.fire('drag', e);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onViewReset: function () {
|
_onViewReset: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user