Split layout is a true 50/50 (explicit half-widths; the horizontal-stretch weights skewed it because the left's intrinsic content out-measured the right). Removed the glass backing plates from the split panel and the song-data metadata block — both sit directly on the atmosphere now. Cover art no longer upscales blurry on large windows: the now-playing large cover decodes at 1000px (was 300, the hover-preview size) so the full Qobuz source resolution comes through, and the split / Static / Album-Reactive panels cap the art at its native size so it grows sharply instead of stretching. New Settings > Appearance 'Immersive default view': 'Remember last' restores the last view, or pin Album Reactive / Static / Coverflow / Spectrum / Lyrics / Queue. Persisted via ui_prefs + ImmersiveActions opened/view-changed hooks. cc
112 lines
5.2 KiB
Plaintext
112 lines
5.2 KiB
Plaintext
// Static foreground (Immersive mode 1) — a faithful port of the Tauri
|
|
// `src/lib/components/immersive/panels/StaticPanel.svelte` (232 lines).
|
|
//
|
|
// A calm, centered now-playing card drawn over the moving ImmersiveAtmosphere
|
|
// background. NON-reactive: it does NOT read VisualizerState.energy at all (no
|
|
// art-scale, no glow halo, no bass/global energy). The ONLY motion is the 4-bar
|
|
// equalizer inside the "Now Playing" indicator — a fixed-period CSS loop in the
|
|
// source (NOT energy-driven), so it is allowed in the static panel and is kept
|
|
// for a faithful port.
|
|
//
|
|
// `parent` is NEVER read in the root binding (Slint gotcha); viewport dims are
|
|
// passed in as properties. `opacity:` is NEVER set on the root (it corrupts
|
|
// absolute positioning); the fade lives on the player/ModeBar chrome instead.
|
|
//
|
|
// DIFF vs AlbumReactivePanel (dropped): global-energy / bass-energy / art-scale
|
|
// / glow-spread / glow-opacity props, the glow Rectangle, the reactive grow
|
|
// `animate`, and the *1.25 breathing footprint. KEPT: EqualizerBars, the
|
|
// now-playing indicator (if playing), title/artist/album/quality, the centered
|
|
// VerticalLayout (pad-top 52 / pad-bottom 132), the artwork image-fit cover +
|
|
// fallback, and the static art drop shadow.
|
|
|
|
import { NowPlayingState } from "../state.slint";
|
|
import { ImmersiveTrackInfo } from "ImmersiveTrackInfo.slint";
|
|
|
|
export component StaticPanel inherits Rectangle {
|
|
in property <length> viewport-width: 1280px;
|
|
in property <length> viewport-height: 720px;
|
|
|
|
// Base art box. The group must leave room for the metadata block + the
|
|
// floating player, or the quality badge gets clipped under the bar. Static
|
|
// has NO breathing growth, so the height budget divides by 1.0 (no /1.25)
|
|
// and the panel gap is 20px (not 40). Reserve = pad-top(52) + spacing(20) +
|
|
// info(160) + player-clearance(132) = 364px. Player clearance 132 is KEPT
|
|
// identical to AlbumReactivePanel (same floating ImmersivePlayerBar); if it
|
|
// changes, BOTH the 132 padding-bottom below and this 364 reserve must move
|
|
// together.
|
|
//
|
|
// RESPONSIVE: previously capped at ~360-460px, which left a LARGE window
|
|
// mostly empty (the art stayed small in a huge frame). We let the art GROW
|
|
// with the window like AlbumReactivePanel: the `vh-364` height budget already
|
|
// scales, and we raise the hard cap 460 -> 640px and the width fraction
|
|
// 0.55 -> 0.62 so a big window is filled. The 180px floor keeps small windows
|
|
// safe (small was confirmed good).
|
|
// Native source resolution — cap so the cover is never UPSCALED beyond its
|
|
// own size on a large window (owner: oversized blurry art looked nefasto).
|
|
property <length> src-native:
|
|
(NowPlayingState.artwork-large.width > 0
|
|
? NowPlayingState.artwork-large.width
|
|
: NowPlayingState.artwork.width) * 1px;
|
|
property <length> base-art: Math.max(180px,
|
|
Math.min(Math.min(Math.min(root.viewport-height - 364px, root.viewport-width * 0.62), 640px), root.src-native));
|
|
// Fixed size — no art-scale.
|
|
property <length> art-size: root.base-art;
|
|
|
|
width: root.viewport-width;
|
|
height: root.viewport-height;
|
|
background: transparent;
|
|
|
|
// Vertical stack: artwork block, then the track-info block. Matches the
|
|
// Svelte column (.static-panel: flex column, centered, gap 20px). Centered
|
|
// as a group in the viewport.
|
|
VerticalLayout {
|
|
x: 0px;
|
|
y: 0px;
|
|
width: root.viewport-width;
|
|
height: root.viewport-height;
|
|
// pad-top 52 = header+controls offset for true visual center (Svelte).
|
|
// pad-bottom 132 = floating-player clearance (owner-mandated, matches
|
|
// AlbumReactivePanel; the Svelte 88 assumes a different player).
|
|
padding-top: 52px;
|
|
padding-bottom: 132px;
|
|
alignment: center;
|
|
spacing: 20px;
|
|
|
|
// --- Artwork (static, no glow, no grow) ----------------------------
|
|
artwork-block := Rectangle {
|
|
// Fixed footprint — no *1.25 (no breathing).
|
|
height: root.base-art;
|
|
horizontal-stretch: 1;
|
|
|
|
// Static drop shadow mirrors the Svelte .artwork-container
|
|
// box-shadow (the two-layer CSS shadow collapses to one blur in
|
|
// Slint — same accepted gap as AlbumReactivePanel).
|
|
art := Rectangle {
|
|
width: root.art-size;
|
|
height: root.art-size;
|
|
x: (parent.width - self.width) / 2;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 8px;
|
|
clip: true;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000080;
|
|
drop-shadow-offset-y: 8px;
|
|
|
|
Image {
|
|
source: NowPlayingState.artwork-large.width > 0
|
|
? NowPlayingState.artwork-large
|
|
: NowPlayingState.artwork;
|
|
image-fit: cover;
|
|
width: parent.width;
|
|
height: parent.height;
|
|
}
|
|
}
|
|
}
|
|
|
|
// --- Track info (shared, homologated across all 3 panels) ----------
|
|
ImmersiveTrackInfo {
|
|
equalizer-tint: #7c3aed;
|
|
}
|
|
}
|
|
}
|