feat(gesture-controller): disable/enable scrolling

This commit is contained in:
Manu Mtz.-Almeida
2016-07-14 00:52:43 +02:00
parent d230cb40fe
commit 72c24bc927
5 changed files with 46 additions and 39 deletions

View File

@@ -31,6 +31,11 @@ export class App {
*/
clickBlock: ClickBlock;
/**
* @private
*/
appRoot: AppRoot;
viewDidLoad: EventEmitter<any> = new EventEmitter();
viewWillEnter: EventEmitter<any> = new EventEmitter();
viewDidEnter: EventEmitter<any> = new EventEmitter();
@@ -86,6 +91,17 @@ export class App {
}
}
/**
* @private
*/
setScrollDisabled(disabled: boolean) {
if (!this.appRoot) {
console.error('appRoot is missing, scrolling can not be enabled/disabled');
return;
}
this.appRoot.disableScroll = disabled;
}
/**
* @private
* Boolean if the app is actively enabled or not.
@@ -282,9 +298,13 @@ export class AppRoot {
@ViewChild('anchor', {read: ViewContainerRef}) private _viewport: ViewContainerRef;
constructor(
private _cmp: UserComponent,
private _cr: ComponentResolver,
private _renderer: Renderer) {}
private _cmp: UserComponent,
private _cr: ComponentResolver,
private _renderer: Renderer,
app: App
) {
app.appRoot = this;
}
ngAfterViewInit() {
// load the user app's root component