diff --git a/code/panes.js b/code/panes.js index cf904f49..4c3898d4 100644 --- a/code/panes.js +++ b/code/panes.js @@ -1,12 +1,6 @@ // created to start cleaning up "window" interaction // window.show = function(id) { - /* - * disable all map properties when switching to another pane - * because sometimes (bug?) touch events are passed to the map when - * other panes are focussed - */ - window.disableMapProperties(); window.hideall(); switch(id) { @@ -26,7 +20,6 @@ window.show = function(id) { window.debug.console.show(); break; case 'map': - window.enableMapProperties(); window.smartphone.mapButton.click(); $('#portal_highlight_select').show(); $('#farm_level_select').show(); @@ -44,20 +37,6 @@ window.show = function(id) { } } -window.enableMapProperties = function() { - window.map.tap.enable(); - window.map.dragging.enable(); - window.map.touchZoom.enable(); - window.map.doubleClickZoom.enable(); -} - -window.disableMapProperties = function() { - window.map.tap.disable(); - window.map.dragging.disable(); - window.map.touchZoom.disable(); - window.map.doubleClickZoom.disable(); -} - window.hideall = function() { $('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide(); $('#farm_level_select').hide(); diff --git a/code/utils_misc.js b/code/utils_misc.js index dc55c6b4..fa34ee5e 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -611,3 +611,13 @@ if(goog && goog.style) { }; } +// Fix Leaflet: handle touchcancel events in Draggable +L.Draggable.prototype._onDownOrig = L.Draggable.prototype._onDown; +L.Draggable.prototype._onDown = function(e) { + L.Draggable.prototype._onDownOrig.apply(this, arguments); + + if(e.type === "touchstart") { + L.DomEvent.on(document, "touchcancel", this._onUp, this); + } +} +