fix key events and add time to fullscreen

This commit is contained in:
2025-02-16 12:40:08 +01:00
parent 83573fde31
commit f49404f8be
3 changed files with 21 additions and 6 deletions

View File

@@ -19,8 +19,8 @@
<app-menu-button (click)="onZoomIn()" @fade [icon]="faZoomIn" class="btn-delete btn-icon" <app-menu-button (click)="onZoomIn()" @fade [icon]="faZoomIn" class="btn-delete btn-icon"
matTooltip="Vergrößern"></app-menu-button> matTooltip="Vergrößern"></app-menu-button>
<app-menu-button (click)="useSwiper=!useSwiper;fullscreen(useSwiper)" @fade <app-menu-button (click)="useSwiper=!useSwiper;fullscreen(useSwiper)" @fade
[icon]="useSwiper ? faFileLines : faFile" class="btn-delete btn-icon" [icon]="useSwiper ? faRestore : faMaximize" class="btn-delete btn-icon"
matTooltip="Swiper umschalten"></app-menu-button> matTooltip="Vollbild"></app-menu-button>
</div> </div>
</div> </div>
<div (cdkDropListDropped)="drop($event, show)" *ngIf="showSongs && !useSwiper" <div (cdkDropListDropped)="drop($event, show)" *ngIf="showSongs && !useSwiper"
@@ -53,6 +53,7 @@
[showText]="true" [showText]="true"
[show]="show" [show]="show"
></app-song> ></app-song>
<div class="time">{{ currentTime | date: 'HH:mm' }}</div>
<div *ngIf="getNextSong(orderedShowSongs(show), i) as next" class="next-song">{{ next }} <div *ngIf="getNextSong(orderedShowSongs(show), i) as next" class="next-song">{{ next }}
<fa-icon [icon]="faNextSong"></fa-icon> <fa-icon [icon]="faNextSong"></fa-icon>
</div> </div>

View File

@@ -60,3 +60,10 @@
padding: 6px; padding: 6px;
} }
} }
.time {
color: #0008;
position: fixed;
bottom: 0;
left: 10px;
}

View File

@@ -14,12 +14,12 @@ import {
faBox, faBox,
faBoxOpen, faBoxOpen,
faChevronRight, faChevronRight,
faFile,
faFileDownload, faFileDownload,
faFileLines,
faLock, faLock,
faMagnifyingGlassMinus, faMagnifyingGlassMinus,
faMagnifyingGlassPlus, faMagnifyingGlassPlus,
faMaximize,
faMinimize,
faSliders, faSliders,
faUnlock, faUnlock,
faUser, faUser,
@@ -101,9 +101,10 @@ export class ShowComponent implements OnInit, OnDestroy {
public faZoomOut = faMagnifyingGlassMinus; public faZoomOut = faMagnifyingGlassMinus;
public useSwiper = false; public useSwiper = false;
public textSize = 1; public textSize = 1;
public faFileLines = faFileLines; public faRestore = faMinimize;
public faFile = faFile; public faMaximize = faMaximize;
public faNextSong = faChevronRight; public faNextSong = faChevronRight;
public currentTime: Date;
private subs: Subscription[] = []; private subs: Subscription[] = [];
public constructor( public constructor(
@@ -119,6 +120,10 @@ export class ShowComponent implements OnInit, OnDestroy {
) {} ) {}
public ngOnInit(): void { public ngOnInit(): void {
this.currentTime = new Date();
setInterval(() => {
this.currentTime = new Date();
}, 10000);
this.show$ = this.activatedRoute.params.pipe( this.show$ = this.activatedRoute.params.pipe(
map(param => param as {showId: string}), map(param => param as {showId: string}),
map(param => param.showId), map(param => param.showId),
@@ -223,6 +228,7 @@ export class ShowComponent implements OnInit, OnDestroy {
@HostListener('document:keydown', ['$event']) @HostListener('document:keydown', ['$event'])
public handleKeyboardEvent(event: KeyboardEvent) { public handleKeyboardEvent(event: KeyboardEvent) {
if (!this.useSwiper) return;
const swiperEl = document.querySelector('swiper-container') as unknown as Swiper; const swiperEl = document.querySelector('swiper-container') as unknown as Swiper;
switch (event.code) { switch (event.code) {
case 'ArrowRight': case 'ArrowRight':
@@ -237,6 +243,7 @@ export class ShowComponent implements OnInit, OnDestroy {
} }
public fullscreen(useSwiper: boolean) { public fullscreen(useSwiper: boolean) {
this.textSize = useSwiper ? 2 : 1;
if (useSwiper) openFullscreen(); if (useSwiper) openFullscreen();
else closeFullscreen(); else closeFullscreen();
} }