瀏覽代碼

prevent accidental swipe gestures when scrubbing video/audio timelines

Hakim El Hattab 4 年之前
父節點
當前提交
be110fad11
共有 3 個文件被更改,包括 4 次插入0 次删除
  1. 0 0
      dist/reveal.esm.js
  2. 0 0
      dist/reveal.js
  3. 4 0
      js/controllers/touch.js

文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.esm.js


文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.js


+ 4 - 0
js/controllers/touch.js

@@ -1,4 +1,5 @@
 import { isAndroid } from '../utils/device.js'
 import { isAndroid } from '../utils/device.js'
+import { matches } from '../utils/util.js'
 
 
 const SWIPE_THRESHOLD = 40;
 const SWIPE_THRESHOLD = 40;
 
 
@@ -82,6 +83,9 @@ export default class Touch {
 	 */
 	 */
 	isSwipePrevented( target ) {
 	isSwipePrevented( target ) {
 
 
+		// Prevent accidental swipes when scrubbing timelines
+		if( matches( target, 'video, audio' ) ) return true;
+
 		while( target && typeof target.hasAttribute === 'function' ) {
 		while( target && typeof target.hasAttribute === 'function' ) {
 			if( target.hasAttribute( 'data-prevent-swipe' ) ) return true;
 			if( target.hasAttribute( 'data-prevent-swipe' ) ) return true;
 			target = target.parentNode;
 			target = target.parentNode;

部分文件因文件數量過多而無法顯示