Created
May 15, 2020 11:58
-
-
Save PerryRylance/ec9e407cebb519e668b0a5da504642c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { | |
if(WPGMZA.isTouchDevice()) | |
{ | |
$(window).on("init.wpgmza", function(event) { | |
var map = event.target; | |
// On touch devices, require two fingers to drag and pan | |
// NB: Temporarily removed due to inconsistent behaviour | |
map.olMap.getInteractions().forEach(function(interaction) { | |
if(interaction instanceof ol.interaction.DragPan) | |
self.olMap.removeInteraction(interaction); | |
}); | |
map.olMap.addInteraction(new ol.interaction.DragPan({ | |
condition: function(olBrowserEvent) { | |
var allowed = olBrowserEvent.originalEvent.touches.length == 2; | |
if(!allowed) | |
self.showGestureOverlay(); | |
return allowed; | |
} | |
})); | |
map.gestureOverlay.text(WPGMZA.localized_strings.use_two_fingers); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment