|
233 | 233 | // Less Precision with touch input
|
234 | 234 | margin = supportsTouch || supportsPointerEvent? 20: 10,
|
235 | 235 |
|
236 |
| - // for ignoring taps from browser's simulated mouse events |
237 |
| - prevTouchTapTime = 0, |
| 236 | + // for ignoring browser's simulated mouse events |
| 237 | + prevTouchTime = 0, |
238 | 238 |
|
239 | 239 | // Allow this many interactions to happen simultaneously
|
240 | 240 | maxInteractions = 1,
|
|
2357 | 2357 |
|
2358 | 2358 | this.tapTime = tap.timeStamp;
|
2359 | 2359 |
|
2360 |
| - if (!this.mouse) { |
2361 |
| - prevTouchTapTime = this.tapTime; |
2362 |
| - } |
2363 |
| - |
2364 | 2360 | for (i = 0; i < targets.length; i++) {
|
2365 | 2361 | var origin = getOriginXY(targets[i], elements[i]);
|
2366 | 2362 |
|
|
2405 | 2401 |
|
2406 | 2402 | collectTaps: function (pointer, event, eventTarget) {
|
2407 | 2403 | if(this.pointerWasMoved
|
2408 |
| - || !(this.downTarget && this.downTarget === eventTarget) |
2409 |
| - || (this.mouse && (new Date().getTime() - prevTouchTapTime) < 300)) { |
| 2404 | + || !(this.downTarget && this.downTarget === eventTarget)) { |
2410 | 2405 | return;
|
2411 | 2406 | }
|
2412 | 2407 |
|
|
2826 | 2821 | i;
|
2827 | 2822 |
|
2828 | 2823 | if (supportsTouch && /touch/.test(event.type)) {
|
| 2824 | + prevTouchTime = new Date().getTime(); |
| 2825 | + |
2829 | 2826 | for (i = 0; i < event.changedTouches.length; i++) {
|
2830 | 2827 | var pointer = event.changedTouches[i];
|
2831 | 2828 |
|
|
2837 | 2834 | }
|
2838 | 2835 | }
|
2839 | 2836 | else {
|
2840 |
| - // ignore mouse events while touch interactions are active |
2841 | 2837 | if (!supportsPointerEvent && /mouse/.test(event.type)) {
|
| 2838 | + // ignore mouse events while touch interactions are active |
2842 | 2839 | for (i = 0; i < interactions.length; i++) {
|
2843 | 2840 | if (!interactions[i].mouse && interactions[i].pointerIsDown) {
|
2844 | 2841 | return;
|
2845 | 2842 | }
|
2846 | 2843 | }
|
| 2844 | + |
| 2845 | + // try to ignore mouse events that are simulated by the browser |
| 2846 | + // after a touch event |
| 2847 | + if (new Date().getTime() - prevTouchTime < 500) { |
| 2848 | + return; |
| 2849 | + } |
2847 | 2850 | }
|
2848 | 2851 |
|
2849 | 2852 | interaction = getInteractionFromPointer(event, event.type, eventTarget);
|
|
0 commit comments