Merge pull request #3504 from alfonso-salces/MOBILE-4081
MOBILE-4081 swipe-slides: Book chapter tags not always shownmain
commit
4fdb77a2a5
|
@ -64,6 +64,8 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
|
||||||
navigationItems: CoreNavigationBarItem<AddonModBookTocChapter>[] = [];
|
navigationItems: CoreNavigationBarItem<AddonModBookTocChapter>[] = [];
|
||||||
slidesOpts: CoreSwipeSlidesOptions = {
|
slidesOpts: CoreSwipeSlidesOptions = {
|
||||||
autoHeight: true,
|
autoHeight: true,
|
||||||
|
observer: true,
|
||||||
|
observeParents: true,
|
||||||
scrollOnChange: 'top',
|
scrollOnChange: 'top',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
|
||||||
protected resizeListener: CoreEventObserver;
|
protected resizeListener: CoreEventObserver;
|
||||||
protected updateSlidesPromise?: Promise<void>;
|
protected updateSlidesPromise?: Promise<void>;
|
||||||
protected activeSlideIndexes: number[] = [];
|
protected activeSlideIndexes: number[] = [];
|
||||||
protected mutationObserver: MutationObserver;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
elementRef: ElementRef<HTMLElement>,
|
elementRef: ElementRef<HTMLElement>,
|
||||||
|
@ -57,14 +56,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
|
||||||
this.resizeListener = CoreDom.onWindowResize(async () => {
|
this.resizeListener = CoreDom.onWindowResize(async () => {
|
||||||
await this.updateSlidesComponent();
|
await this.updateSlidesComponent();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mutationObserver = new MutationObserver(() => {
|
|
||||||
setTimeout(async () => {
|
|
||||||
await this.updateSlidesComponent();
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.mutationObserver.observe(this.hostElement, { subtree: true, childList: true });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -321,7 +312,6 @@ export class CoreSwipeSlidesComponent<Item = unknown> implements OnChanges, OnDe
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.unsubscribe && this.unsubscribe();
|
this.unsubscribe && this.unsubscribe();
|
||||||
this.resizeListener.off();
|
this.resizeListener.off();
|
||||||
this.mutationObserver.disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue