Leaflet 1.0: revert elevation diagram touch events on desktop browsers
Workaround for MrMufflon/Leaflet.Elevation#67
This commit is contained in:
parent
cd6c1bdc54
commit
761a053b72
1 changed files with 24 additions and 1 deletions
|
|
@ -7,7 +7,30 @@ BR.Elevation = L.Control.Elevation.extend({
|
||||||
bottom: 30,
|
bottom: 30,
|
||||||
left: 60
|
left: 60
|
||||||
},
|
},
|
||||||
theme: "steelblue-theme" //purple
|
theme: "steelblue-theme"
|
||||||
|
},
|
||||||
|
|
||||||
|
onAdd: function (map) {
|
||||||
|
var container = L.Control.Elevation.prototype.onAdd.call(this, map);
|
||||||
|
|
||||||
|
// revert registering touch events when touch screen detection is available and negative
|
||||||
|
// see https://github.com/MrMufflon/Leaflet.Elevation/issues/67
|
||||||
|
if (L.Browser.touch && BR.Browser.touchScreenDetectable && !BR.Browser.touchScreen) {
|
||||||
|
|
||||||
|
this._background.on("touchmove.drag", null).
|
||||||
|
on("touchstart.drag", null).
|
||||||
|
on("touchstart.focus", null);
|
||||||
|
L.DomEvent.off(this._container, 'touchend', this._dragEndHandler, this);
|
||||||
|
|
||||||
|
this._background.on("mousemove.focus", this._mousemoveHandler.bind(this)).
|
||||||
|
on("mouseout.focus", this._mouseoutHandler.bind(this)).
|
||||||
|
on("mousedown.drag", this._dragStartHandler.bind(this)).
|
||||||
|
on("mousemove.drag", this._dragHandler.bind(this));
|
||||||
|
L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return container;
|
||||||
},
|
},
|
||||||
|
|
||||||
addBelow: function(map) {
|
addBelow: function(map) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue