Revert "Revert "Merge branch 'master' of https://github.com/driftyco/ionic""

This reverts commit 4a6086c1f8.
This commit is contained in:
perry
2016-07-18 19:40:03 -05:00
parent 4a6086c1f8
commit 4f52135c13
86 changed files with 5592 additions and 3938 deletions

View File

@@ -1,6 +1,6 @@
import { Directive, ElementRef, Input } from '@angular/core';
import { AppRoot } from '../app/app';
import { DisableScroll, GestureController, GestureDelegate } from '../../gestures/gesture-controller';
import { isTrueProperty } from '../../util/util';
@@ -16,41 +16,21 @@ import { isTrueProperty } from '../../util/util';
},
})
export class Backdrop {
private static nuBackDrops: number = 0;
private static push(appRoot: AppRoot) {
if (this.nuBackDrops === 0) {
appRoot.disableScroll = true;
}
this.nuBackDrops++;
}
private static pop(appRoot: AppRoot) {
if (this.nuBackDrops > 0) {
this.nuBackDrops--;
if (this.nuBackDrops === 0) {
appRoot.disableScroll = false;
}
}
}
private pushed: boolean = false;
private _gestureID: number = null;
@Input() disableScroll = true;
constructor(private _appRoot: AppRoot, private _elementRef: ElementRef) {}
constructor(private _gestureCtrl: GestureController, private _elementRef: ElementRef) {}
ngOnInit() {
if (isTrueProperty(this.disableScroll)) {
Backdrop.push(this._appRoot);
this.pushed = true;
this._gestureID = this._gestureCtrl.newID();
this._gestureCtrl.disableScroll(this._gestureID);
}
}
ngOnDestroy() {
if (this.pushed) {
Backdrop.pop(this._appRoot);
this.pushed = false;
if (this._gestureID) {
this._gestureCtrl.enableScroll(this._gestureID);
}
}