From c059b7a014df44508191416ea219efabe15041b5 Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Tue, 29 Nov 2022 09:18:08 +0100 Subject: [PATCH] Activate hidden sections with specified delay --- docs/release-notes-editor.md | 2 ++ docs/release-notes-player.md | 1 + docs/unit_definition_changelog.txt | 1 + projects/common/models/section.ts | 2 ++ .../src/app/components/canvas/section-menu.component.ts | 9 ++++++++- projects/editor/src/assets/i18n/de.json | 3 ++- .../directives/section-visibility-handling.directive.ts | 6 ++++-- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/release-notes-editor.md b/docs/release-notes-editor.md index 2b7ea56f6..b8c3aac79 100644 --- a/docs/release-notes-editor.md +++ b/docs/release-notes-editor.md @@ -23,6 +23,8 @@ Editor - Möglichkeit, die maximale Zeichenanzahl von Eingabefeldern zu begrenzen - Im TextEditor können nun Bereiche markiert werden, die dann im Navigationsknopf über die Aktion "Textabschnitt hervorheben" ausgewählt werden können. +- Ermöglicht die Angabe einer Verzögerung (in Millisekunden) + für Aktivieren von verborgenen Abschnitten ### Verbesserungen - Ermöglicht für Eingabebereiche die dynamische Anpassung der Anzahl von Zeilen diff --git a/docs/release-notes-player.md b/docs/release-notes-player.md index 64606df9b..b3e8fd84e 100644 --- a/docs/release-notes-player.md +++ b/docs/release-notes-player.md @@ -17,6 +17,7 @@ Player Text über die Zwischenablage eingefügt werden - Vordefinierte markierte Bereiche in Texten können gezielt über vordefinierte Klicks auf Navigationsknöpfe für 30 Sekunden farblich hervorgehoben werden +- Aktiviert verborgene Abschnitten mit der angegebenen Verzögerung (in Millisekunden) ### Verbesserungen - Verbessert die Performanz von GeoGebra-Elementen diff --git a/docs/unit_definition_changelog.txt b/docs/unit_definition_changelog.txt index 1a9fc32f9..b3d50bd9e 100644 --- a/docs/unit_definition_changelog.txt +++ b/docs/unit_definition_changelog.txt @@ -58,6 +58,7 @@ iqb-aspect-definition@1.0.0 - Remove drop-list-simple as cloze child; is now a drop-list - ButtonElement: action +highlightText param +string +- Section: +activeAfterIdDelay: number 3.9.0 - DropListElement: +deleteDroppedItemWithSameID diff --git a/projects/common/models/section.ts b/projects/common/models/section.ts index fffe89e51..c96778320 100644 --- a/projects/common/models/section.ts +++ b/projects/common/models/section.ts @@ -16,6 +16,7 @@ export class Section { gridColumnSizes: string = '1fr 1fr'; gridRowSizes: string = '1fr'; activeAfterID: string | null = null; + activeAfterIdDelay: number = 0; constructor(section?: Partial<Section>) { if (section?.height) this.height = section.height; @@ -26,6 +27,7 @@ export class Section { if (section?.gridColumnSizes !== undefined) this.gridColumnSizes = section.gridColumnSizes; if (section?.gridRowSizes !== undefined) this.gridRowSizes = section.gridRowSizes; if (section?.activeAfterID) this.activeAfterID = section.activeAfterID; + if (section?.activeAfterIdDelay) this.activeAfterIdDelay = section.activeAfterIdDelay; this.elements = section?.elements?.map(element => ElementFactory.createElement({ ...element, diff --git a/projects/editor/src/app/components/canvas/section-menu.component.ts b/projects/editor/src/app/components/canvas/section-menu.component.ts index 773a0e52b..e49cc778a 100644 --- a/projects/editor/src/app/components/canvas/section-menu.component.ts +++ b/projects/editor/src/app/components/canvas/section-menu.component.ts @@ -54,8 +54,15 @@ import { SelectionService } from '../../services/selection.service'; (click)="$any($event).stopPropagation()" (change)="updateModel('activeAfterID', $any($event.target).value)"> </mat-form-field> + <mat-form-field appearance="fill"> + <mat-label>{{'section-menu.activeAfterIdDelay' | translate }}</mat-label> + <input matInput type="number" step="1000" min="0" + [disabled]="!section.activeAfterID" + [value]="$any(section.activeAfterIdDelay)" + (click)="$any($event).stopPropagation()" + (change)="updateModel('activeAfterIdDelay', $any($event.target).value)"> + </mat-form-field> </mat-menu> - <button mat-mini-fab [matMenuTriggerFor]="layoutMenu" [matTooltip]="'Layout'" [matTooltipPosition]="'left'"> <mat-icon>space_dashboard</mat-icon> diff --git a/projects/editor/src/assets/i18n/de.json b/projects/editor/src/assets/i18n/de.json index b1bbf8c8a..c453e794a 100644 --- a/projects/editor/src/assets/i18n/de.json +++ b/projects/editor/src/assets/i18n/de.json @@ -270,7 +270,8 @@ "width": "Breite", "fraction": "Anteile", "pixel": "Bildpunkte", - "activeAfterID": "Sichtbar nach A/V-ID" + "activeAfterID": "Sichtbar nach A/V-ID", + "activeAfterIdDelay": "Verzögerung der Sichtbarkeit" }, "Bitte kopierten Abschnitt einfügen": "Bitte kopierten Abschnitt einfügen", "Doppelte IDs festgestellt. Weiter mit neu generierten IDs?": "Doppelte IDs festgestellt. Weiter mit neu generierten IDs?", 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 4304384c4..cfcd928e8 100644 --- a/projects/player/src/app/directives/section-visibility-handling.directive.ts +++ b/projects/player/src/app/directives/section-visibility-handling.directive.ts @@ -1,5 +1,5 @@ import { Directive, ElementRef, Input } from '@angular/core'; -import { Subject } from 'rxjs'; +import { delay, Subject } from 'rxjs'; import { Section } from 'common/models/section'; import { takeUntil } from 'rxjs/operators'; @@ -27,7 +27,9 @@ export class SectionVisibilityHandlingDirective { if (this.mediaStatusChanged) { this.mediaStatusChanged - .pipe(takeUntil(this.ngUnsubscribe)) + .pipe( + takeUntil(this.ngUnsubscribe), + delay(this.section.activeAfterIdDelay)) .subscribe((id: string): void => this.setActiveAfterID(id)); } } -- GitLab