feat: autoscroll standard, visualizzazione tag/date e OCR spaziale avanzato
- Aggiunto autoscroll standard con controllo velocità (V1-V10) e relativo toggle in settings. - Implementata la visualizzazione opzionale di tag e data aggiornamento nella lista canti. - Rinnovata la pagina 'Proponi Canto' con tastiera accordi (fondamentale + variazioni) e OCR spaziale potenziato per l'allineamento automatico degli accordi con il testo. - Ottimizzata la persistenza della modalità schermo intero.
This commit is contained in:
@@ -27,6 +27,11 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
public showChords = signal<boolean>(false);
|
||||
public showSensitivitySlider = signal<boolean>(false);
|
||||
|
||||
/** Autoscroll standard */
|
||||
public isAutoscrolling = signal<boolean>(false);
|
||||
public autoscrollSpeed = signal<number>(2);
|
||||
private autoscrollTimer: any = null;
|
||||
|
||||
/** Font size scale factor (1.0 = default) */
|
||||
public fontSize = signal<number>(1.0);
|
||||
|
||||
@@ -524,6 +529,47 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
return info && info.num_canto ? info.num_canto.toString() : null;
|
||||
}
|
||||
|
||||
toggleAutoscroll() {
|
||||
if (this.isAutoscrolling()) {
|
||||
this.stopAutoscroll();
|
||||
} else {
|
||||
this.startAutoscroll();
|
||||
}
|
||||
}
|
||||
|
||||
startAutoscroll() {
|
||||
this.isAutoscrolling.set(true);
|
||||
if (this.autoscrollTimer) clearInterval(this.autoscrollTimer);
|
||||
|
||||
const scrollEl = this.el.nativeElement.querySelector('.lyrics-container');
|
||||
if (!scrollEl) return;
|
||||
|
||||
this.autoscrollTimer = setInterval(() => {
|
||||
if (!this.isAutoscrolling()) {
|
||||
clearInterval(this.autoscrollTimer);
|
||||
return;
|
||||
}
|
||||
const step = this.autoscrollSpeed() * 0.25;
|
||||
scrollEl.scrollTop += step;
|
||||
}, 40);
|
||||
}
|
||||
|
||||
stopAutoscroll() {
|
||||
this.isAutoscrolling.set(false);
|
||||
if (this.autoscrollTimer) {
|
||||
clearInterval(this.autoscrollTimer);
|
||||
this.autoscrollTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
increaseAutoscrollSpeed() {
|
||||
this.autoscrollSpeed.update(s => Math.min(10, s + 1));
|
||||
}
|
||||
|
||||
decreaseAutoscrollSpeed() {
|
||||
this.autoscrollSpeed.update(s => Math.max(1, s - 1));
|
||||
}
|
||||
|
||||
private logPreviousSongTime() {
|
||||
const c = this.canto();
|
||||
if (c && this.songStartTime > 0) {
|
||||
@@ -534,6 +580,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.stopAutoscroll();
|
||||
this.logPreviousSongTime();
|
||||
this.audioEngine.stopListening();
|
||||
this.channel.close();
|
||||
|
||||
Reference in New Issue
Block a user