From 17c0543a392025f043eb3e57dcfeeb354730016a Mon Sep 17 00:00:00 2001 From: Manuel Mtz-Almeida Date: Thu, 6 Apr 2017 23:54:12 +0200 Subject: [PATCH] =?UTF-8?q?perf(toggle):=20toggle=E2=80=99s=20button=20is?= =?UTF-8?q?=20not=20activated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/toggle/toggle.ts | 2 +- src/tap-click/activator.ts | 5 +++++ src/tap-click/tap-click.ts | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/toggle/toggle.ts b/src/components/toggle/toggle.ts index 83a0e814e3..72f77ce40d 100644 --- a/src/components/toggle/toggle.ts +++ b/src/components/toggle/toggle.ts @@ -70,7 +70,7 @@ export const TOGGLE_VALUE_ACCESSOR: any = { '[attr.aria-checked]="_value" ' + '[attr.aria-labelledby]="_labelId" ' + '[attr.aria-disabled]="_disabled" ' + - 'class="item-cover">' + + 'class="item-cover" disable-activated>' + '', host: { '[class.toggle-disabled]': '_disabled' diff --git a/src/tap-click/activator.ts b/src/tap-click/activator.ts index aab095d501..9e87505296 100644 --- a/src/tap-click/activator.ts +++ b/src/tap-click/activator.ts @@ -6,10 +6,12 @@ import { PointerCoordinates } from '../util/dom'; export class Activator implements ActivatorBase { + protected _queue: HTMLElement[] = []; protected _active: HTMLElement[] = []; protected _activeDefer: Function; protected _clearDefer: Function; + _css: string; activatedDelay = ADD_ACTIVATED_DEFERS; clearDelay = CLEAR_STATE_DEFERS; @@ -19,6 +21,9 @@ export class Activator implements ActivatorBase { } clickAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates) { + if (isActivatedDisabled(ev, activatableEle)) { + return; + } // a click happened, so immediately deactive all activated elements this._scheduleClear(); diff --git a/src/tap-click/tap-click.ts b/src/tap-click/tap-click.ts index 8da3d720f9..9f8f7c3f8b 100644 --- a/src/tap-click/tap-click.ts +++ b/src/tap-click/tap-click.ts @@ -18,6 +18,7 @@ import { UIEventManager } from '../gestures/ui-event-manager'; */ @Injectable() export class TapClick { + private disableClick: number = 0; private usePolyfill: boolean; private activator: ActivatorBase; @@ -236,7 +237,7 @@ function getActivatableTarget(ele: HTMLElement): any { /** * @hidden */ -export const isActivatable = function (ele: HTMLElement) { +export function isActivatable(ele: HTMLElement) { if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) { return true; }