@@ -25,10 +25,12 @@ export class SuperTabsPanGesture {
25
25
26
26
private listeners : Function [ ] = [ ] ;
27
27
28
- constructor ( private plt : Platform ,
29
- private el : HTMLElement ,
30
- private config : SuperTabsConfig ,
31
- private rnd : Renderer2 ) {
28
+ constructor (
29
+ private plt : Platform ,
30
+ private el : HTMLElement ,
31
+ private config : SuperTabsConfig ,
32
+ private rnd : Renderer2
33
+ ) {
32
34
33
35
this . listeners . push (
34
36
rnd . listen ( el , 'touchstart' , this . _onStart . bind ( this ) ) ,
@@ -51,6 +53,20 @@ export class SuperTabsPanGesture {
51
53
}
52
54
53
55
private _onStart ( ev : TouchEvent ) {
56
+ // check avoid this element
57
+ var avoid = false ;
58
+ var element : any = ev . target ;
59
+ if ( element ) {
60
+ do {
61
+ if ( element . getAttribute && element . getAttribute ( 'avoid-super-tabs' ) ) avoid = true ;
62
+ element = element . parentElement ;
63
+ } while ( element && ! avoid ) ;
64
+ }
65
+ if ( avoid ) {
66
+ this . shouldCapture = false ;
67
+ return ;
68
+ }
69
+
54
70
const coords : PointerCoordinates = pointerCoord ( ev ) ,
55
71
vw = this . plt . width ( ) ;
56
72
@@ -75,12 +91,12 @@ export class SuperTabsPanGesture {
75
91
if ( ! this . isDragging ) {
76
92
77
93
if ( typeof this . shouldCapture !== 'boolean' )
78
- // we haven't decided yet if we want to capture this gesture
94
+ // we haven't decided yet if we want to capture this gesture
79
95
this . checkGesture ( coords ) ;
80
96
81
97
82
98
if ( this . shouldCapture === true )
83
- // gesture is good, let's capture all next onTouchMove events
99
+ // gesture is good, let's capture all next onTouchMove events
84
100
this . isDragging = true ;
85
101
else
86
102
return ;
@@ -127,6 +143,7 @@ export class SuperTabsPanGesture {
127
143
}
128
144
129
145
private checkGesture ( newCoords : PointerCoordinates ) {
146
+ if ( ! this . initialCoords ) return ;
130
147
131
148
const radians = this . config . maxDragAngle * ( Math . PI / 180 ) ,
132
149
maxCosine = Math . cos ( radians ) ,
0 commit comments