Преглед на файлове

Determine correct event

only repsond to one event on machines that can handle touch and mouse events
gh-pages
Dan Barela преди 7 години
родител
ревизия
373ccb1178
променени са 3 файла, в които са добавени 9 реда и са изтрити 9 реда
  1. 4
    4
      index.js
  2. 4
    4
      leaflet-side-by-side.js
  3. 1
    1
      leaflet-side-by-side.min.js

+ 4
- 4
index.js Целия файл

@@ -174,8 +174,8 @@ L.Control.SideBySide = L.Control.extend({
174 174
     map.on('move', this._updateClip, this)
175 175
     map.on('layeradd layerremove', this._updateLayers, this)
176 176
     on(range, getRangeEvent(range), this._updateClip, this)
177
-    on(range, 'mousedown touchstart', cancelMapDrag, this)
178
-    on(range, 'mouseup touchend', uncancelMapDrag, this)
177
+    on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
178
+    on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
179 179
   },
180 180
 
181 181
   _removeEvents: function () {
@@ -183,8 +183,8 @@ L.Control.SideBySide = L.Control.extend({
183 183
     var map = this._map
184 184
     if (range) {
185 185
       off(range, getRangeEvent(range), this._updateClip, this)
186
-      off(range, 'mousedown touchstart', cancelMapDrag, this)
187
-      off(range, 'mouseup touchend', uncancelMapDrag, this)
186
+      off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
187
+      off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
188 188
     }
189 189
     if (map) {
190 190
       map.off('layeradd layerremove', this._updateLayers, this)

+ 4
- 4
leaflet-side-by-side.js Целия файл

@@ -176,8 +176,8 @@ L.Control.SideBySide = L.Control.extend({
176 176
     map.on('move', this._updateClip, this)
177 177
     map.on('layeradd layerremove', this._updateLayers, this)
178 178
     on(range, getRangeEvent(range), this._updateClip, this)
179
-    on(range, 'mousedown touchstart', cancelMapDrag, this)
180
-    on(range, 'mouseup touchend', uncancelMapDrag, this)
179
+    on(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
180
+    on(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
181 181
   },
182 182
 
183 183
   _removeEvents: function () {
@@ -185,8 +185,8 @@ L.Control.SideBySide = L.Control.extend({
185 185
     var map = this._map
186 186
     if (range) {
187 187
       off(range, getRangeEvent(range), this._updateClip, this)
188
-      off(range, 'mousedown touchstart', cancelMapDrag, this)
189
-      off(range, 'mouseup touchend', uncancelMapDrag, this)
188
+      off(range, L.Browser.touch ? 'touchstart' : 'mousedown', cancelMapDrag, this)
189
+      off(range, L.Browser.touch ? 'touchend' : 'mouseup', uncancelMapDrag, this)
190 190
     }
191 191
     if (map) {
192 192
       map.off('layeradd layerremove', this._updateLayers, this)

+ 1
- 1
leaflet-side-by-side.min.js
Файловите разлики са ограничени, защото са твърде много
Целия файл


Loading…
Отказ
Запис