refactor: zoom a livello di dispositivo e rimozione zoom da playlist

This commit is contained in:
David Frassi
2026-07-14 01:47:57 +02:00
parent 73097bf9bd
commit ad9286002b
4 changed files with 31 additions and 17 deletions
+13 -13
View File
@@ -313,13 +313,9 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
if (playlistSongSetting) { if (playlistSongSetting) {
this.transposeAmount.set(playlistSongSetting.tonalita !== undefined ? playlistSongSetting.tonalita : 0); this.transposeAmount.set(playlistSongSetting.tonalita !== undefined ? playlistSongSetting.tonalita : 0);
this.autoscrollSpeed.set(playlistSongSetting.speed !== undefined ? playlistSongSetting.speed : 2); this.autoscrollSpeed.set(playlistSongSetting.speed !== undefined ? playlistSongSetting.speed : 2);
if (playlistSongSetting.zoom !== undefined) { const gZoom = this.settingsService.globalZoom();
this.fontSize.set(playlistSongSetting.zoom); this.fontSize.set(gZoom);
this.portraitFontSize = playlistSongSetting.zoom; this.portraitFontSize = gZoom;
} else {
this.fontSize.set(1.0);
this.portraitFontSize = 1.0;
}
} else if (this.comunitaService.comunitaCode() && this.comunitaService.isFilterActive()) { } else if (this.comunitaService.comunitaCode() && this.comunitaService.isFilterActive()) {
const settings = this.comunitaService.comunitaCantiSettings(); const settings = this.comunitaService.comunitaCantiSettings();
const songSetting = settings.find(s => s.id_canti === c.id_canti || s.id_canti === Number(c.id)); const songSetting = settings.find(s => s.id_canti === c.id_canti || s.id_canti === Number(c.id));
@@ -339,13 +335,15 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
this.transposeAmount.set(0); this.transposeAmount.set(0);
this.autoscrollSpeed.set(2); this.autoscrollSpeed.set(2);
} }
this.fontSize.set(1.0); const gZoom = this.settingsService.globalZoom();
this.portraitFontSize = 1.0; this.fontSize.set(gZoom);
this.portraitFontSize = gZoom;
} else { } else {
this.transposeAmount.set(0); this.transposeAmount.set(0);
this.autoscrollSpeed.set(2); this.autoscrollSpeed.set(2);
this.fontSize.set(1.0); const gZoom = this.settingsService.globalZoom();
this.portraitFontSize = 1.0; this.fontSize.set(gZoom);
this.portraitFontSize = gZoom;
} }
}, { allowSignalWrites: true }); }, { allowSignalWrites: true });
@@ -577,6 +575,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
this.fontSize.set(limited); this.fontSize.set(limited);
if (!this.isLandscape()) { if (!this.isLandscape()) {
this.portraitFontSize = limited; this.portraitFontSize = limited;
this.settingsService.globalZoom.set(limited);
} }
this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() });
} }
@@ -615,8 +614,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
activePlaylistId, activePlaylistId,
c.id, c.id,
this.transposeAmount(), this.transposeAmount(),
this.autoscrollSpeed(), this.autoscrollSpeed()
this.fontSize()
); );
} }
} }
@@ -644,6 +642,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
this.fontSize.set(limited); this.fontSize.set(limited);
if (!this.isLandscape()) { if (!this.isLandscape()) {
this.portraitFontSize = limited; this.portraitFontSize = limited;
this.settingsService.globalZoom.set(limited);
} }
this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() });
this.updatePlaylistSettings(); this.updatePlaylistSettings();
@@ -658,6 +657,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
this.fontSize.set(target); this.fontSize.set(target);
if (!this.isLandscape()) { if (!this.isLandscape()) {
this.portraitFontSize = target; this.portraitFontSize = target;
this.settingsService.globalZoom.set(target);
} }
this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() });
this.updatePlaylistSettings(); this.updatePlaylistSettings();
+2 -3
View File
@@ -401,15 +401,14 @@ export class PlaylistService {
this.syncLocalDataToServer(); this.syncLocalDataToServer();
} }
async updatePlaylistSongSettings(playlistId: string, songId: string, tonalita: number, speed: number, zoom?: number) { async updatePlaylistSongSettings(playlistId: string, songId: string, tonalita: number, speed: number) {
await this.initPromise; await this.initPromise;
this.playlists.update(p => p.map(pl => { this.playlists.update(p => p.map(pl => {
if (pl.id === playlistId) { if (pl.id === playlistId) {
const songSettings = { ...(pl.songSettings || {}) }; const songSettings = { ...(pl.songSettings || {}) };
songSettings[songId] = { songSettings[songId] = {
tonalita, tonalita,
speed, speed
zoom: zoom !== undefined ? zoom : songSettings[songId]?.zoom
}; };
return { ...pl, songSettings }; return { ...pl, songSettings };
} }
+15
View File
@@ -59,6 +59,9 @@ export class SettingsService {
/** Schermo nero per l'ascolto delle playlist in macchina: true = attivo */ /** Schermo nero per l'ascolto delle playlist in macchina: true = attivo */
public carModeBlackScreen = signal<boolean>(false); public carModeBlackScreen = signal<boolean>(false);
/** Global zoom/font size factor for song presentation */
public globalZoom = signal<number>(1.0);
/** Identificativo utente univoco per la gestione delle comunità */ /** Identificativo utente univoco per la gestione delle comunità */
public userUuid = signal<string>(''); public userUuid = signal<string>('');
@@ -264,6 +267,14 @@ export class SettingsService {
this.carModeBlackScreen.set(false); this.carModeBlackScreen.set(false);
} }
const savedGlobalZoom = localStorage.getItem('global-zoom');
if (savedGlobalZoom !== null) {
const parsed = parseFloat(savedGlobalZoom);
this.globalZoom.set(isNaN(parsed) ? 1.0 : parsed);
} else {
this.globalZoom.set(1.0);
}
// Sync browser fullscreen state with listeners (supporting vendor prefixes) // Sync browser fullscreen state with listeners (supporting vendor prefixes)
const updateFullscreenState = () => { const updateFullscreenState = () => {
const isFs = !!( const isFs = !!(
@@ -325,6 +336,10 @@ export class SettingsService {
localStorage.setItem('car-mode-black-screen', this.carModeBlackScreen().toString()); localStorage.setItem('car-mode-black-screen', this.carModeBlackScreen().toString());
}); });
effect(() => {
localStorage.setItem('global-zoom', this.globalZoom().toString());
});
effect(() => { effect(() => {
const active = this.keepScreenOn(); const active = this.keepScreenOn();
localStorage.setItem('keep-screen-on', active.toString()); localStorage.setItem('keep-screen-on', active.toString());
+1 -1
View File
@@ -1 +1 @@
export const VERSION = '2026.07.13.1915'; export const VERSION = '2026.07.13.1941';