@@ -6,7 +6,7 @@ var HANDLERS = {};
6
6
* as well as other information abstracted from the DOM.
7
7
*/
8
8
9
- var pointer , lastPointer , forceSkipClickHijack = false ;
9
+ var pointer , lastPointer , forceSkipClickHijack = false , maxClickDistance = 6 ;
10
10
11
11
/**
12
12
* The position of the most recent click if that click was on a label element.
@@ -21,7 +21,7 @@ angular
21
21
. module ( 'material.core.gestures' , [ ] )
22
22
. provider ( '$mdGesture' , MdGestureProvider )
23
23
. factory ( '$$MdGestureHandler' , MdGestureHandler )
24
- . run ( attachToDocument ) ;
24
+ . run ( attachToDocument ) ;
25
25
26
26
/**
27
27
* @ngdoc service
@@ -32,6 +32,7 @@ angular
32
32
* In some scenarios on Mobile devices (without jQuery), the click events should NOT be hijacked.
33
33
* `$mdGestureProvider` is used to configure the Gesture module to ignore or skip click hijacking on mobile
34
34
* devices.
35
+ * You can also change max click distance (6px by default) if you have issues on some touch screens.
35
36
*
36
37
* <hljs lang="js">
37
38
* app.config(function($mdGestureProvider) {
@@ -40,6 +41,9 @@ angular
40
41
* // intercept click events during the capture phase.
41
42
* $mdGestureProvider.skipClickHijack();
42
43
*
44
+ * // If hijcacking clicks, change default 6px click distance
45
+ * $mdGestureProvider.setMaxClickDistance(12);
46
+ *
43
47
* });
44
48
* </hljs>
45
49
*
@@ -54,6 +58,10 @@ MdGestureProvider.prototype = {
54
58
return forceSkipClickHijack = true ;
55
59
} ,
56
60
61
+ setMaxClickDistance : function ( clickDistance ) {
62
+ maxClickDistance = parseInt ( clickDistance ) ;
63
+ } ,
64
+
57
65
/**
58
66
* $get is used to build an instance of $mdGesture
59
67
* @ngInject
@@ -84,7 +92,6 @@ function MdGesture($$MdGestureHandler, $$rAF, $timeout) {
84
92
} ;
85
93
86
94
if ( self . isHijackingClicks ) {
87
- var maxClickDistance = 6 ;
88
95
self . handler ( 'click' , {
89
96
options : {
90
97
maxDistance : maxClickDistance
0 commit comments