mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
feat(ui): scale the whole window with Interface Scale (#781)
* experiment(zoom): allow setting webview zoom via core capability * experiment(zoom): drive uiScale through Tauri's native webview zoom Replace the CSS `zoom: uiScale` on `.main-content-zoom` (which only scaled the main content column, leaving the sidebar, queue panel, player bar and portaled overlays at 1.0) with a `setZoom` call on the current webview. That scales everything inside the window the same way Ctrl+/− does in a browser, including portals and the queue panel. Effect runs whenever `uiScale` changes and once on mount, so the persisted setting is reapplied on launch. * docs: changelog + credits for interface scale (#781)
This commit is contained in:
committed by
GitHub
parent
bca45d5a80
commit
b4782aeedb
@@ -2,6 +2,7 @@ import React, { Suspense, useCallback, useEffect, useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { ensurePlaybackServerActive } from '../utils/playback/playbackServer';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { getCurrentWebview } from '@tauri-apps/api/webview';
|
||||
import { PanelRight } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import Sidebar from '../components/Sidebar';
|
||||
@@ -122,6 +123,13 @@ export function AppShell() {
|
||||
useEqStore.getState().syncToRust();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
getCurrentWebview().setZoom(uiScale).catch(() => {
|
||||
/* setZoom may fail on platforms where the capability is unavailable;
|
||||
fall back silently so the rest of the shell still renders. */
|
||||
});
|
||||
}, [uiScale]);
|
||||
|
||||
useNowPlayingTrayTitle(currentTrack, isPlaying);
|
||||
|
||||
// Post-update changelog is now surfaced via a dismissible banner in the
|
||||
@@ -178,7 +186,7 @@ export function AppShell() {
|
||||
/>
|
||||
)}
|
||||
<main className="main-content">
|
||||
<div className="main-content-zoom" style={uiScale !== 1 ? { zoom: uiScale } : undefined}>
|
||||
<div className="main-content-zoom">
|
||||
<header className="content-header">
|
||||
<LiveSearch />
|
||||
<div className="spacer" />
|
||||
|
||||
Reference in New Issue
Block a user