refactor: zoom a livello di dispositivo e rimozione zoom da playlist
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ export class SettingsService {
|
||||
/** Schermo nero per l'ascolto delle playlist in macchina: true = attivo */
|
||||
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à */
|
||||
public userUuid = signal<string>('');
|
||||
|
||||
@@ -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());
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export const VERSION = '2026.07.13.1915';
|
||||
export const VERSION = '2026.07.13.1941';
|
||||
|
||||
Reference in New Issue
Block a user