From ad9286002b896eb5d135484732d0ee020e3d13b7 Mon Sep 17 00:00:00 2001 From: David Frassi Date: Tue, 14 Jul 2026 01:47:57 +0200 Subject: [PATCH] refactor: zoom a livello di dispositivo e rimozione zoom da playlist --- src/app/pages/player/player.page.ts | 26 +++++++++++++------------- src/app/services/playlist.service.ts | 5 ++--- src/app/services/settings.service.ts | 15 +++++++++++++++ src/app/version.ts | 2 +- 4 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/app/pages/player/player.page.ts b/src/app/pages/player/player.page.ts index 8baad98..4693e23 100644 --- a/src/app/pages/player/player.page.ts +++ b/src/app/pages/player/player.page.ts @@ -313,13 +313,9 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy { if (playlistSongSetting) { this.transposeAmount.set(playlistSongSetting.tonalita !== undefined ? playlistSongSetting.tonalita : 0); this.autoscrollSpeed.set(playlistSongSetting.speed !== undefined ? playlistSongSetting.speed : 2); - if (playlistSongSetting.zoom !== undefined) { - this.fontSize.set(playlistSongSetting.zoom); - this.portraitFontSize = playlistSongSetting.zoom; - } else { - this.fontSize.set(1.0); - this.portraitFontSize = 1.0; - } + const gZoom = this.settingsService.globalZoom(); + this.fontSize.set(gZoom); + this.portraitFontSize = gZoom; } else if (this.comunitaService.comunitaCode() && this.comunitaService.isFilterActive()) { const settings = this.comunitaService.comunitaCantiSettings(); 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.autoscrollSpeed.set(2); } - this.fontSize.set(1.0); - this.portraitFontSize = 1.0; + const gZoom = this.settingsService.globalZoom(); + this.fontSize.set(gZoom); + this.portraitFontSize = gZoom; } else { this.transposeAmount.set(0); this.autoscrollSpeed.set(2); - this.fontSize.set(1.0); - this.portraitFontSize = 1.0; + const gZoom = this.settingsService.globalZoom(); + this.fontSize.set(gZoom); + this.portraitFontSize = gZoom; } }, { allowSignalWrites: true }); @@ -577,6 +575,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy { this.fontSize.set(limited); if (!this.isLandscape()) { this.portraitFontSize = limited; + this.settingsService.globalZoom.set(limited); } this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); } @@ -615,8 +614,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy { activePlaylistId, c.id, this.transposeAmount(), - this.autoscrollSpeed(), - this.fontSize() + this.autoscrollSpeed() ); } } @@ -644,6 +642,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy { this.fontSize.set(limited); if (!this.isLandscape()) { this.portraitFontSize = limited; + this.settingsService.globalZoom.set(limited); } this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); this.updatePlaylistSettings(); @@ -658,6 +657,7 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy { this.fontSize.set(target); if (!this.isLandscape()) { this.portraitFontSize = target; + this.settingsService.globalZoom.set(target); } this.channel.postMessage({ type: 'SYNC_FONT', fontSize: this.fontSize() }); this.updatePlaylistSettings(); diff --git a/src/app/services/playlist.service.ts b/src/app/services/playlist.service.ts index 437d4c2..d29385b 100644 --- a/src/app/services/playlist.service.ts +++ b/src/app/services/playlist.service.ts @@ -401,15 +401,14 @@ export class PlaylistService { 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; this.playlists.update(p => p.map(pl => { if (pl.id === playlistId) { const songSettings = { ...(pl.songSettings || {}) }; songSettings[songId] = { tonalita, - speed, - zoom: zoom !== undefined ? zoom : songSettings[songId]?.zoom + speed }; return { ...pl, songSettings }; } diff --git a/src/app/services/settings.service.ts b/src/app/services/settings.service.ts index d9f5752..54cb055 100644 --- a/src/app/services/settings.service.ts +++ b/src/app/services/settings.service.ts @@ -59,6 +59,9 @@ export class SettingsService { /** Schermo nero per l'ascolto delle playlist in macchina: true = attivo */ public carModeBlackScreen = signal(false); + /** Global zoom/font size factor for song presentation */ + public globalZoom = signal(1.0); + /** Identificativo utente univoco per la gestione delle comunità */ public userUuid = signal(''); @@ -264,6 +267,14 @@ export class SettingsService { 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) const updateFullscreenState = () => { const isFs = !!( @@ -325,6 +336,10 @@ export class SettingsService { localStorage.setItem('car-mode-black-screen', this.carModeBlackScreen().toString()); }); + effect(() => { + localStorage.setItem('global-zoom', this.globalZoom().toString()); + }); + effect(() => { const active = this.keepScreenOn(); localStorage.setItem('keep-screen-on', active.toString()); diff --git a/src/app/version.ts b/src/app/version.ts index 5744caa..f564fdd 100644 --- a/src/app/version.ts +++ b/src/app/version.ts @@ -1 +1 @@ -export const VERSION = '2026.07.13.1915'; +export const VERSION = '2026.07.13.1941';