mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -78,7 +78,9 @@ var tapTouchFocusedInput;
|
||||
var tapLastTouchTarget;
|
||||
var tapTouchMoveListener = 'touchmove';
|
||||
|
||||
var TAP_RELEASE_TOLERANCE = 6; // how much the coordinates can be off between start/end, but still a click
|
||||
// how much the coordinates can be off between start/end, but still a click
|
||||
var TAP_RELEASE_TOLERANCE = 6; // default tolerance
|
||||
var TAP_RELEASE_BUTTON_TOLERANCE = 50; // button elements should have a larger tolerance
|
||||
|
||||
var tapEventListeners = {
|
||||
'click': tapClickGateKeeper,
|
||||
@@ -234,8 +236,9 @@ ionic.tap = {
|
||||
return false;
|
||||
},
|
||||
|
||||
setTolerance: function(val) {
|
||||
TAP_RELEASE_TOLERANCE = val;
|
||||
setTolerance: function(releaseTolerance, releaseButtonTolerance) {
|
||||
TAP_RELEASE_TOLERANCE = releaseTolerance;
|
||||
TAP_RELEASE_BUTTON_TOLERANCE = releaseButtonTolerance;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -502,8 +505,10 @@ function tapHasPointerMoved(endEvent) {
|
||||
}
|
||||
var endCoordinates = getPointerCoordinates(endEvent);
|
||||
|
||||
return Math.abs(tapPointerStart.x - endCoordinates.x) > TAP_RELEASE_TOLERANCE ||
|
||||
Math.abs(tapPointerStart.y - endCoordinates.y) > TAP_RELEASE_TOLERANCE;
|
||||
var releaseTolerance = (endEvent.target.classList.contains('button') ? TAP_RELEASE_BUTTON_TOLERANCE : TAP_RELEASE_TOLERANCE);
|
||||
|
||||
return Math.abs(tapPointerStart.x - endCoordinates.x) > releaseTolerance ||
|
||||
Math.abs(tapPointerStart.y - endCoordinates.y) > releaseTolerance;
|
||||
}
|
||||
|
||||
function getPointerCoordinates(event) {
|
||||
|
||||
Reference in New Issue
Block a user