MOBILE-2676 ux: Fix top margin when rotating
parent
f171854ea9
commit
b47a373382
|
@ -185,8 +185,9 @@ export class MoodleMobileApp implements OnInit {
|
|||
viewport.setAttribute('content', 'viewport-fit=cover,' + viewport.getAttribute('content'));
|
||||
});
|
||||
}
|
||||
|
||||
this.eventsProvider.trigger(CoreEventsProvider.ORIENTATION_CHANGE);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ export const CORE_PROVIDERS: any[] = [
|
|||
})
|
||||
export class AppModule {
|
||||
constructor(platform: Platform, initDelegate: CoreInitDelegate, updateManager: CoreUpdateManagerProvider, config: Config,
|
||||
sitesProvider: CoreSitesProvider, fileProvider: CoreFileProvider) {
|
||||
sitesProvider: CoreSitesProvider, fileProvider: CoreFileProvider, private eventsProvider: CoreEventsProvider) {
|
||||
// Register a handler for platform ready.
|
||||
initDelegate.registerProcess({
|
||||
name: 'CorePlatformReady',
|
||||
|
@ -484,5 +484,51 @@ export class AppModule {
|
|||
// Initial imgs refresh.
|
||||
this.imgsUpdate();
|
||||
};
|
||||
|
||||
const eventsProvider = this.eventsProvider;
|
||||
|
||||
// tslint:disable: typedef
|
||||
(<any> Content).prototype.ngAfterViewInit = function() {
|
||||
assert(this.getFixedElement(), 'fixed element was not found');
|
||||
assert(this.getScrollElement(), 'scroll element was not found');
|
||||
|
||||
const scroll = this._scroll;
|
||||
scroll.ev.fixedElement = this.getFixedElement();
|
||||
scroll.ev.scrollElement = this.getScrollElement();
|
||||
|
||||
// Subscribe to the scroll start
|
||||
scroll.onScrollStart = (ev) => {
|
||||
this.ionScrollStart.emit(ev);
|
||||
};
|
||||
|
||||
// Subscribe to every scroll move
|
||||
scroll.onScroll = (ev) => {
|
||||
// Emit to all of our other friends things be scrolling
|
||||
this.ionScroll.emit(ev);
|
||||
|
||||
this.imgsUpdate();
|
||||
};
|
||||
|
||||
// Subscribe to the scroll end
|
||||
scroll.onScrollEnd = (ev) => {
|
||||
this.ionScrollEnd.emit(ev);
|
||||
|
||||
this.imgsUpdate();
|
||||
};
|
||||
|
||||
// Recalculate size when screen rotates.
|
||||
this._orientationObs = eventsProvider.on(CoreEventsProvider.ORIENTATION_CHANGE, this.resize.bind(this));
|
||||
};
|
||||
|
||||
// tslint:disable: typedef
|
||||
(<any> Content).prototype.ngOnDestroy = function() {
|
||||
this._scLsn && this._scLsn();
|
||||
this._viewCtrlReadSub && this._viewCtrlReadSub.unsubscribe();
|
||||
this._viewCtrlWriteSub && this._viewCtrlWriteSub.unsubscribe();
|
||||
this._viewCtrlReadSub = this._viewCtrlWriteSub = null;
|
||||
this._scroll && this._scroll.destroy();
|
||||
this._footerEle = this._scLsn = this._scroll = null;
|
||||
this._orientationObs && this._orientationObs.off();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ export class CoreEventsProvider {
|
|||
static FILE_SHARED = 'file_shared';
|
||||
static KEYBOARD_CHANGE = 'keyboard_change';
|
||||
static CORE_LOADING_CHANGED = 'core_loading_changed';
|
||||
static ORIENTATION_CHANGE = 'orientation_change';
|
||||
|
||||
protected logger;
|
||||
protected observables: { [s: string]: Subject<any> } = {};
|
||||
|
|
Loading…
Reference in New Issue