From 9fbe479bbf842795b96547d14d16773e9b7d78bd Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Tue, 13 Dec 2022 12:43:19 +0100 Subject: [PATCH] [player] Fix scrolling of hidden sections with different delays --- docs/release-notes-editor.md | 5 ++++- docs/release-notes-player.md | 3 +++ .../directives/section-visibility-handling.directive.ts | 9 ++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/release-notes-editor.md b/docs/release-notes-editor.md index b1d8ff014..5447e3b9d 100644 --- a/docs/release-notes-editor.md +++ b/docs/release-notes-editor.md @@ -1,6 +1,9 @@ Editor ====== -##1.35.2 +## 1.35.3 + + +## 1.35.2 ### Verbesserungen - Wendet die Eigenschaft "Schreibgeschützt" auf Formel Elemente an - Auswahllisten, die nur ein Element zulassen, werden von diesem Element komplett ausgefüllt diff --git a/docs/release-notes-player.md b/docs/release-notes-player.md index af5bb6e21..f0b78eb06 100644 --- a/docs/release-notes-player.md +++ b/docs/release-notes-player.md @@ -1,5 +1,8 @@ Player ====== +## 1.28.3 +### Fehlerbehebungen +- Korrigiert das Scroll-Verhalten von versteckten Abschnitten mit unterschiedlichen Verzögerungen ## 1.28.2 ### Verbesserungen diff --git a/projects/player/src/app/directives/section-visibility-handling.directive.ts b/projects/player/src/app/directives/section-visibility-handling.directive.ts index cfcd928e8..5255465a6 100644 --- a/projects/player/src/app/directives/section-visibility-handling.directive.ts +++ b/projects/player/src/app/directives/section-visibility-handling.directive.ts @@ -22,7 +22,8 @@ export class SectionVisibilityHandlingDirective { this.isScrollSection = this.isVisible ? false : this.pageSections - .filter(pageSection => pageSection.activeAfterID === this.section.activeAfterID) + .filter(pageSection => pageSection.activeAfterID === this.section.activeAfterID && + pageSection.activeAfterIdDelay === this.section.activeAfterIdDelay) .findIndex(section => section === this.section) === 0; if (this.mediaStatusChanged) { @@ -38,8 +39,10 @@ export class SectionVisibilityHandlingDirective { if (!this.isVisible) { this.setVisibility(id === this.section.activeAfterID); if (this.isScrollSection) { - this.elementRef.nativeElement.style.scrollMargin = `${window.innerHeight / 3}px`; - this.elementRef.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); + this.elementRef.nativeElement.style.scrollMarginTop = 100; + setTimeout(() => { + this.elementRef.nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start' }); + }); } } } -- GitLab