fix(tapclick): click to non-activable elements

This commit is contained in:
Manu Mtz.-Almeida
2016-12-05 18:27:50 +01:00
parent f5b4980e35
commit c6facf37fe

View File

@ -56,6 +56,12 @@ export class TapClick {
if (this.startCoord) { if (this.startCoord) {
return false; return false;
} }
if (!this.app.isEnabled()) {
return false;
}
this.lastTouchEnd = 0;
this.dispatchClick = true;
let activatableEle = getActivatableTarget(ev.target); let activatableEle = getActivatableTarget(ev.target);
if (!activatableEle) { if (!activatableEle) {
@ -63,8 +69,6 @@ export class TapClick {
return false; return false;
} }
this.lastTouchEnd = 0;
this.dispatchClick = true;
this.startCoord = pointerCoord(ev); this.startCoord = pointerCoord(ev);
this.activator && this.activator.downAction(ev, activatableEle, this.startCoord); this.activator && this.activator.downAction(ev, activatableEle, this.startCoord);
return true; return true;
@ -102,6 +106,7 @@ export class TapClick {
pointerCancel(ev: UIEvent) { pointerCancel(ev: UIEvent) {
console.debug(`pointerCancel from ${ev.type} ${Date.now()}`); console.debug(`pointerCancel from ${ev.type} ${Date.now()}`);
this.startCoord = null; this.startCoord = null;
this.dispatchClick = false; this.dispatchClick = false;
this.activator && this.activator.clearState(); this.activator && this.activator.clearState();
@ -149,6 +154,10 @@ export class TapClick {
console.debug('click prevent: appDisabled'); console.debug('click prevent: appDisabled');
return true; return true;
} }
if (this.gestureCtrl.isCaptured()) {
console.debug('click prevent: tap-click (gesture is captured)');
return true;
}
return false; return false;
} }