From 41f2942fe7a2e8ff1bad339fc4400a295d8de7a9 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 14 Sep 2015 21:43:55 -0500 Subject: [PATCH] improve css deactivate fallback --- ionic/components/app/activator.ts | 2 +- ionic/components/app/app.ts | 8 ++++---- ionic/components/overlay/overlay.ts | 2 +- ionic/components/text-input/text-input.ts | 2 +- ionic/components/view/view-controller.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ionic/components/app/activator.ts b/ionic/components/app/activator.ts index 2edb426d0d..5687b3973b 100644 --- a/ionic/components/app/activator.ts +++ b/ionic/components/app/activator.ts @@ -257,7 +257,7 @@ export class Activator { deactivate() { const self = this; - if (self.app.isTransitioning() && self.deactivateAttempt < 10) { + if (self.app.isTransitioning() && self.deactivateAttempt < 30) { // the app is actively transitioning, don't bother deactivating // anything this makes it easier on the GPU so it doesn't // have to redraw any buttons during a transition diff --git a/ionic/components/app/app.ts b/ionic/components/app/app.ts index 79e7428a67..9d9f7cc520 100644 --- a/ionic/components/app/app.ts +++ b/ionic/components/app/app.ts @@ -40,7 +40,7 @@ export class IonicApp { */ constructor() { this.overlays = []; - this._transTime = 0; + this._transDone = 0; // Our component registry map this.components = {}; @@ -82,8 +82,8 @@ export class IonicApp { * slides up, etc. After the transition completes it is set back to `false`. * @param {bool} isTransitioning */ - setTransitioning(isTransitioning) { - this._transTime = (isTransitioning ? Date.now() : 0); + setTransitioning(isTransitioning, msTilDone=800) { + this._transDone = (isTransitioning ? Date.now() + msTilDone : 0); } /** @@ -91,7 +91,7 @@ export class IonicApp { * @return {bool} */ isTransitioning() { - return (this._transTime + 800 > Date.now()); + return (this._transDone > Date.now()); } /** diff --git a/ionic/components/overlay/overlay.ts b/ionic/components/overlay/overlay.ts index 019d665b9f..0aa164ee9f 100644 --- a/ionic/components/overlay/overlay.ts +++ b/ionic/components/overlay/overlay.ts @@ -162,7 +162,7 @@ export class OverlayRef { animation.after.removeClass('show-overlay'); ClickBlock(true, animation.duration() + 200); - this.app.setTransitioning(true); + this.app.setTransitioning(true, animation.duration() + 200); animation.play().then(() => { instance.viewDidLeave && instance.viewDidLeave(); diff --git a/ionic/components/text-input/text-input.ts b/ionic/components/text-input/text-input.ts index 40e8d56fa2..d88d911d79 100644 --- a/ionic/components/text-input/text-input.ts +++ b/ionic/components/text-input/text-input.ts @@ -235,7 +235,7 @@ export class TextInput extends Ion { // manually scroll the text input to the top // do not allow any clicks while it's scrolling ClickBlock(true, SCROLL_INTO_VIEW_DURATION + 100); - this.app.setTransitioning(true); + this.app.setTransitioning(true, SCROLL_INTO_VIEW_DURATION + 100); // temporarily move the focus to the focus holder so the browser // doesn't freak out while it's trying to get the input in place diff --git a/ionic/components/view/view-controller.ts b/ionic/components/view/view-controller.ts index 1fcfe8ee54..dfdff88c1f 100644 --- a/ionic/components/view/view-controller.ts +++ b/ionic/components/view/view-controller.ts @@ -279,7 +279,7 @@ export class ViewController extends Ion { // block any clicks during the transition and provide a // fallback to remove the clickblock if something goes wrong ClickBlock(true, duration + 200); - this.app.setTransitioning(true); + this.app.setTransitioning(true, duration + 200); } // start the transition @@ -398,7 +398,7 @@ export class ViewController extends Ion { swipeBackProgress(progress) { if (this.sbTransition) { ClickBlock(true, 4000); - this.app.setTransitioning(true); + this.app.setTransitioning(true, 4000); this.sbTransition.progress( Math.min(1, Math.max(0, progress)) ); } }