1
0
Fork 0

Add ability to prevent swipe for specific elements

This commit is contained in:
Calyhre 2014-06-18 14:18:08 +02:00
parent e4761d3a37
commit 4e70cf8126
1 changed files with 13 additions and 0 deletions

View File

@ -3482,6 +3482,8 @@
*/ */
function onTouchStart( event ) { function onTouchStart( event ) {
if(preventSwipe(event.target)) return true;
touch.startX = event.touches[0].clientX; touch.startX = event.touches[0].clientX;
touch.startY = event.touches[0].clientY; touch.startY = event.touches[0].clientY;
touch.startCount = event.touches.length; touch.startCount = event.touches.length;
@ -3505,6 +3507,8 @@
*/ */
function onTouchMove( event ) { function onTouchMove( event ) {
if(preventSwipe(event.target)) return true;
// Each touch should only trigger one action // Each touch should only trigger one action
if( !touch.captured ) { if( !touch.captured ) {
onUserInput( event ); onUserInput( event );
@ -3786,6 +3790,15 @@
} }
function preventSwipe(target) {
while( target && typeof target.hasAttribute == 'function' ) {
if(target.hasAttribute('prevent-swipe')) return true;
target = target.parentNode;
}
return false;
}
// --------------------------------------------------------------------// // --------------------------------------------------------------------//
// ------------------------ PLAYBACK COMPONENT ------------------------// // ------------------------ PLAYBACK COMPONENT ------------------------//