From 6991c993f130c1b08516938dd1682be9c11e34ab Mon Sep 17 00:00:00 2001 From: tkempken Date: Mon, 12 Sep 2022 11:07:11 +0200 Subject: [PATCH] fix QuantStack/leaflet-splitmap#10 --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 5603722..63b5041 100644 --- a/src/index.js +++ b/src/index.js @@ -156,8 +156,8 @@ L.Control.SplitMap = L.Control.extend({ map.on('move', this._updateClip, this) map.on('layeradd layerremove', this._updateLayers, this) on(range, getRangeEvent(range), this._updateClip, this) - on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this) - on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this) + on(range, 'ontouchstart' in window ? 'touchstart' : 'mousedown', cancelMapDrag, this) + on(range, 'ontouchstart' in window ? 'touchend' : 'mouseup', uncancelMapDrag, this) }, _removeEvents: function () { @@ -165,8 +165,8 @@ L.Control.SplitMap = L.Control.extend({ var map = this._map if (range) { off(range, getRangeEvent(range), this._updateClip, this) - off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this) - off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this) + off(range, 'ontouchstart' in window ? 'touchstart' : 'mousedown', cancelMapDrag, this) + off(range, 'ontouchstart' in window ? 'touchend' : 'mouseup', uncancelMapDrag, this) } if (map) { map.off('layeradd layerremove', this._updateLayers, this)