perf(toggle): toggle’s button is not activated

This commit is contained in:
Manuel Mtz-Almeida
2017-04-06 23:54:12 +02:00
parent ea8213b39a
commit 17c0543a39
3 changed files with 8 additions and 2 deletions

View File

@ -70,7 +70,7 @@ export const TOGGLE_VALUE_ACCESSOR: any = {
'[attr.aria-checked]="_value" ' + '[attr.aria-checked]="_value" ' +
'[attr.aria-labelledby]="_labelId" ' + '[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' + '[attr.aria-disabled]="_disabled" ' +
'class="item-cover">' + 'class="item-cover" disable-activated>' +
'</button>', '</button>',
host: { host: {
'[class.toggle-disabled]': '_disabled' '[class.toggle-disabled]': '_disabled'

View File

@ -6,10 +6,12 @@ import { PointerCoordinates } from '../util/dom';
export class Activator implements ActivatorBase { export class Activator implements ActivatorBase {
protected _queue: HTMLElement[] = []; protected _queue: HTMLElement[] = [];
protected _active: HTMLElement[] = []; protected _active: HTMLElement[] = [];
protected _activeDefer: Function; protected _activeDefer: Function;
protected _clearDefer: Function; protected _clearDefer: Function;
_css: string; _css: string;
activatedDelay = ADD_ACTIVATED_DEFERS; activatedDelay = ADD_ACTIVATED_DEFERS;
clearDelay = CLEAR_STATE_DEFERS; clearDelay = CLEAR_STATE_DEFERS;
@ -19,6 +21,9 @@ export class Activator implements ActivatorBase {
} }
clickAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates) { clickAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates) {
if (isActivatedDisabled(ev, activatableEle)) {
return;
}
// a click happened, so immediately deactive all activated elements // a click happened, so immediately deactive all activated elements
this._scheduleClear(); this._scheduleClear();

View File

@ -18,6 +18,7 @@ import { UIEventManager } from '../gestures/ui-event-manager';
*/ */
@Injectable() @Injectable()
export class TapClick { export class TapClick {
private disableClick: number = 0; private disableClick: number = 0;
private usePolyfill: boolean; private usePolyfill: boolean;
private activator: ActivatorBase; private activator: ActivatorBase;
@ -236,7 +237,7 @@ function getActivatableTarget(ele: HTMLElement): any {
/** /**
* @hidden * @hidden
*/ */
export const isActivatable = function (ele: HTMLElement) { export function isActivatable(ele: HTMLElement) {
if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) { if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) {
return true; return true;
} }