Patch Leaflet drag offset bug
This commit is contained in:
parent
91108bc334
commit
84a69e0af1
1 changed files with 16 additions and 0 deletions
16
js/util/LeafletPatches.js
Normal file
16
js/util/LeafletPatches.js
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Fixes wrong added offset when dragging, which can leave mouse off the marker
|
||||||
|
// after dragging and cause a map click
|
||||||
|
// see https://github.com/Leaflet/Leaflet/pull/7446
|
||||||
|
// see https://github.com/Leaflet/Leaflet/issues/4457
|
||||||
|
L.Draggable.prototype._onMoveOrig = L.Draggable.prototype._onMove;
|
||||||
|
L.Draggable.prototype._onMove = function (e) {
|
||||||
|
var start = !this._moved;
|
||||||
|
|
||||||
|
this._onMoveOrig.call(this, e);
|
||||||
|
|
||||||
|
if (start && this._moved) {
|
||||||
|
var offset = this._newPos.subtract(this._startPos);
|
||||||
|
this._startPos = this._startPos.add(offset);
|
||||||
|
this._newPos = this._newPos.add(offset);
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue