Commit 09fcffb 1 parent aa9dd89 commit 09fcffb Copy full SHA for 09fcffb
File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,26 @@ import {mixinEventEmitter} from '@theatersoft/bus'
4
4
const stack = [ ] // stack of sinks
5
5
let sink = { }
6
6
7
+ const filterTouchMouse = _touch => f => e => {
8
+ if ( e . type === 'tap' ) {
9
+ if ( _touch && e . gesture . pointerType === 'mouse' ) {
10
+ _touch = false
11
+ return
12
+ }
13
+ _touch = e . gesture . pointerType === 'touch'
14
+ }
15
+ f ( e )
16
+ }
17
+
7
18
const focus = new ( mixinEventEmitter ( class {
8
19
constructor ( ) {
9
20
Hammer ( window . document . body , {
10
21
drag_lock_to_axis : true
11
22
} )
12
- . on ( "tap dragleft dragright dragend swipeleft swiperight" , e => {
23
+ . on ( "tap dragleft dragright dragend swipeleft swiperight" , filterTouchMouse ( ) ( e => {
13
24
if ( sink . onGesture ) sink . onGesture ( e )
14
25
else if ( sink . emit ) sink . emit ( 'gesture' , e )
15
- } )
26
+ } ) )
16
27
17
28
document . onkeydown = e => {
18
29
if ( e . keyCode === 8 ) {
You can’t perform that action at this time.
0 commit comments