mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
run tapPolyfill for mouse pointerType too
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
|
||||
function tapPolyfill(orgEvent) {
|
||||
// if the source event wasn't from a touch event then don't use this polyfill
|
||||
if(!orgEvent.gesture || orgEvent.gesture.pointerType !== "touch" || !orgEvent.gesture.srcEvent) return;
|
||||
if(!orgEvent.gesture || !orgEvent.gesture.srcEvent) return;
|
||||
|
||||
var e = orgEvent.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js
|
||||
var ele = e.target;
|
||||
@@ -151,7 +151,7 @@
|
||||
function isRecentTap(event) {
|
||||
// loop through the tap coordinates and see if the same area has been tapped recently
|
||||
var tapId, existingCoordinates, currentCoordinates,
|
||||
hitRadius = 20;
|
||||
hitRadius = 15;
|
||||
|
||||
for(tapId in tapCoordinates) {
|
||||
existingCoordinates = tapCoordinates[tapId];
|
||||
@@ -170,7 +170,7 @@
|
||||
function recordCoordinates(event) {
|
||||
var c = getCoordinates(event);
|
||||
if(c.x && c.y) {
|
||||
var tapId = 'ts' + Date.now();
|
||||
var tapId = 't' + Date.now();
|
||||
|
||||
// only record tap coordinates if we have valid ones
|
||||
tapCoordinates[tapId] = { x: c.x, y:c.y };
|
||||
@@ -201,7 +201,7 @@
|
||||
}
|
||||
|
||||
var tapCoordinates = {}; // used to remember coordinates to ignore if they happen again quickly
|
||||
var CLICK_PREVENT_DURATION = 450; // amount of milliseconds to check for ghostclicks
|
||||
var CLICK_PREVENT_DURATION = 350; // amount of milliseconds to check for ghostclicks
|
||||
|
||||
// set global click handler and check if the event should stop or not
|
||||
document.addEventListener('click', preventGhostClick, true);
|
||||
|
||||
Reference in New Issue
Block a user