mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 16:16:41 +08:00
fix(all): gestures should use a passive listener (#21038)
This commit is contained in:
@ -2,7 +2,6 @@ import { Component, ComponentInterface, Event, EventEmitter, Host, Listen, Prop,
|
||||
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { GESTURE_CONTROLLER } from '../../utils/gesture';
|
||||
import { now } from '../../utils/helpers';
|
||||
|
||||
@Component({
|
||||
tag: 'ion-backdrop',
|
||||
@ -14,7 +13,6 @@ import { now } from '../../utils/helpers';
|
||||
})
|
||||
export class Backdrop implements ComponentInterface {
|
||||
|
||||
private lastClick = -10000;
|
||||
private blocker = GESTURE_CONTROLLER.createBlocker({
|
||||
disableScroll: true
|
||||
});
|
||||
@ -49,18 +47,9 @@ export class Backdrop implements ComponentInterface {
|
||||
this.blocker.unblock();
|
||||
}
|
||||
|
||||
@Listen('touchstart', { passive: false, capture: true })
|
||||
protected onTouchStart(ev: TouchEvent) {
|
||||
this.lastClick = now(ev);
|
||||
this.emitTap(ev);
|
||||
}
|
||||
|
||||
@Listen('click', { passive: false, capture: true })
|
||||
@Listen('mousedown', { passive: false, capture: true })
|
||||
protected onMouseDown(ev: TouchEvent) {
|
||||
if (this.lastClick < now(ev) - 2500) {
|
||||
this.emitTap(ev);
|
||||
}
|
||||
this.emitTap(ev);
|
||||
}
|
||||
|
||||
private emitTap(ev: Event) {
|
||||
|
||||
Reference in New Issue
Block a user