do not deactivate buttons during transition

Closes #94
This commit is contained in:
Adam Bradley
2015-09-09 10:03:48 -05:00
parent 72b419030a
commit e46863640e
5 changed files with 62 additions and 37 deletions

View File

@@ -39,6 +39,7 @@ export class IonicApp {
*/
constructor() {
this.overlays = [];
this._isTransitioning = false;
// Our component registry map
this.components = {};
@@ -74,6 +75,24 @@ export class IonicApp {
document.title = val;
}
/**
* Sets if the app is currently transitioning or not. For example
* this is set to `true` while views transition, a modal slides up, an action-menu
* slides up, etc. After the transition completes it is set back to `false`.
* @param {bool} isTransitioning
*/
setTransitioning(isTransitioning) {
this._isTransitioning = !!isTransitioning;
}
/**
* Boolean if the app is actively transitioning or not.
* @return {bool}
*/
isTransitioning() {
return this._isTransitioning;
}
/**
* TODO
* @param {TODO=} val TODO

View File

@@ -128,6 +128,7 @@ export class OverlayRef {
animation.before.addClass('show-overlay');
ClickBlock(true, animation.duration() + 200);
this.app.setTransitioning(true);
this.app.zoneRunOutside(() => {
@@ -135,6 +136,7 @@ export class OverlayRef {
this.app.zoneRun(() => {
ClickBlock(false);
this.app.setTransitioning(false);
animation.dispose();
instance.viewDidEnter && instance.viewDidEnter();
resolve();
@@ -160,6 +162,7 @@ export class OverlayRef {
animation.after.removeClass('show-overlay');
ClickBlock(true, animation.duration() + 200);
this.app.setTransitioning(true);
animation.play().then(() => {
instance.viewDidLeave && instance.viewDidLeave();
@@ -168,6 +171,7 @@ export class OverlayRef {
this._dispose();
ClickBlock(false);
this.app.setTransitioning(false);
animation.dispose();
resolve();

View File

@@ -228,6 +228,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);
// 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
@@ -242,6 +243,7 @@ export class TextInput extends Ion {
// all good, allow clicks again
ClickBlock(false);
this.app.setTransitioning(false);
});
} else {

View File

@@ -279,6 +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);
}
// start the transition
@@ -396,6 +397,7 @@ export class ViewController extends Ion {
swipeBackProgress(progress) {
if (this.sbTransition) {
ClickBlock(true, 4000);
this.app.setTransitioning(true);
this.sbTransition.progress( Math.min(1, Math.max(0, progress)) );
}
}
@@ -481,6 +483,7 @@ export class ViewController extends Ion {
// allow clicks again
ClickBlock(false);
this.app.setTransitioning(false);
}
/**