chore(release): v0.1.4 - 1:1 SyncLyrics, scroll isolation, object-fit cover, Concerts icon, friends' likes & duplicate-title albums
This commit is contained in:
parent
0b2561503f
commit
f063382410
21 changed files with 1287 additions and 288 deletions
|
|
@ -80,6 +80,8 @@ pub struct ShellUiState {
|
|||
pub queue_drag: Option<QueueDragState>,
|
||||
pub fs_lyrics_scroll_y: f32,
|
||||
pub fs_lyrics_manual_until: f64,
|
||||
pub fs_lyrics_upper_until: f64,
|
||||
pub fs_lyrics_last_mouse: Option<Pos2>,
|
||||
pub fs_lyrics_track_id: String,
|
||||
}
|
||||
|
||||
|
|
@ -640,37 +642,9 @@ pub fn render_fullscreen_player(
|
|||
ctx.register_blocker(screen);
|
||||
ctx.dl().push_rect(screen, 0.0, bg_color);
|
||||
|
||||
// Top-right circular `v` collapse button (`FullscreenPlayerDesktop_closeButton`)
|
||||
let close_r = Rect::from_center_size(
|
||||
Pos2::new(screen.right() - 44.0, screen.top() + 56.0),
|
||||
Vec2::splat(40.0),
|
||||
);
|
||||
let close_resp = ctx.interact(WidgetId::new("fs_close"), close_r);
|
||||
ctx.dl().push_circle(
|
||||
close_r.center(),
|
||||
if close_resp.hovered { 21.0 } else { 20.0 },
|
||||
if close_resp.hovered {
|
||||
css_rgba(255, 255, 255, 36)
|
||||
} else {
|
||||
css_rgba(255, 255, 255, 22)
|
||||
},
|
||||
);
|
||||
ctx.draw_icon(
|
||||
Icon::ArrowDown,
|
||||
Rect::from_center_size(close_r.center(), Vec2::splat(24.0)),
|
||||
Color::WHITE,
|
||||
);
|
||||
if close_resp.hovered {
|
||||
ctx.set_cursor(CursorKind::Pointer);
|
||||
ctx.show_tooltip(close_r, i18n.close());
|
||||
}
|
||||
if close_resp.clicked {
|
||||
actions.push(AppAction::SetFullscreen(false));
|
||||
}
|
||||
|
||||
let Some(tr) = track else {
|
||||
return;
|
||||
};
|
||||
// Render track player + 50/50 split BEFORE top-right `v` collapse button so
|
||||
// SyncLyrics top gradient fade mask never slices over `FullscreenPlayerDesktop_closeButton`!
|
||||
if let Some(tr) = track {
|
||||
|
||||
// Mutually exclusive right split modes (SyncLyrics OR PlayQueue) WITHOUT closing fullscreen!
|
||||
let is_split = app.fullscreen_lyrics_open || app.fullscreen_queue_open;
|
||||
|
|
@ -692,7 +666,8 @@ pub fn render_fullscreen_player(
|
|||
let cx_center = screen.center_x();
|
||||
let cx_left = screen.left() + screen.width() * 0.25;
|
||||
let cx = cx_center + (cx_left - cx_center) * split_t;
|
||||
let cov_cy = screen.center_y() - 36.0;
|
||||
// Center the entire (poster + 110px info) block symmetrically around `screen.center_y()`
|
||||
let cov_cy = screen.center_y() - 55.0;
|
||||
let cov_r = Rect::from_center_size(Pos2::new(cx, cov_cy), Vec2::splat(cov_sz));
|
||||
|
||||
// Soft cover elevation shadow
|
||||
|
|
@ -956,7 +931,7 @@ pub fn render_fullscreen_player(
|
|||
}
|
||||
|
||||
// Below Cover: Clickable Track Title + Explicit + Individually Clickable Artists
|
||||
let title_y = cov_r.bottom() + 20.0;
|
||||
let title_y = cov_r.bottom() + 24.0;
|
||||
let meta_w = cov_sz.max(320.0);
|
||||
let full_title = tr.full_title();
|
||||
let measured_tw = ctx
|
||||
|
|
@ -1003,7 +978,7 @@ pub fn render_fullscreen_player(
|
|||
}
|
||||
|
||||
// Individually clickable artists below title (`SeparatedArtists`)!
|
||||
let art_r = Rect::from_center_size(Pos2::new(cx, title_y + 34.0), Vec2::new(meta_w, 22.0));
|
||||
let art_r = Rect::from_xywh(cx - meta_w * 0.5, title_y + 26.0, meta_w, 22.0);
|
||||
if let Some((aid, aname)) = separated_artists(
|
||||
ctx,
|
||||
pal,
|
||||
|
|
@ -1020,7 +995,7 @@ pub fn render_fullscreen_player(
|
|||
}
|
||||
|
||||
// Progress bar (`ChangeTimecode`: 4px `#E6E6E6` fill/thumb + hover timecodes + smooth drag seek)
|
||||
let bar_y = title_y + 64.0;
|
||||
let bar_y = cov_r.bottom() + 86.0;
|
||||
let bar_hit = Rect::from_center_size(Pos2::new(cx, bar_y), Vec2::new(cov_sz, 22.0));
|
||||
let bar_resp = ctx.interact(WidgetId::new("fs_progress"), bar_hit);
|
||||
let bar_r = Rect::from_center_size(Pos2::new(cx, bar_y), Vec2::new(cov_sz, 4.0));
|
||||
|
|
@ -1090,13 +1065,24 @@ pub fn render_fullscreen_player(
|
|||
ctx.dl().push_circle(Pos2::new(fill_x, bar_y), 6.0, fill_col);
|
||||
}
|
||||
|
||||
// Right-Half 50/50 Animated Pane: SyncLyrics OR PlayQueue!
|
||||
// Right-Half 50/50 Animated Pane (`FullscreenPlayerDesktopContent_additionalContent`): SyncLyrics OR PlayQueue!
|
||||
if split_t > 0.02 {
|
||||
let right_rect = Rect::from_min_max(
|
||||
Pos2::new(screen.left() + screen.width() * 0.48, screen.top() + 56.0),
|
||||
Pos2::new(screen.right() - 48.0, screen.bottom() - 40.0),
|
||||
);
|
||||
let indent = if screen.width() > 1060.0 {
|
||||
44.0
|
||||
} else if screen.width() > 960.0 {
|
||||
20.0
|
||||
} else {
|
||||
10.0
|
||||
};
|
||||
let right_left = screen.left() + screen.width() * 0.50 - indent;
|
||||
let right_right = (right_left + screen.width() * 0.50).min(screen.right());
|
||||
let right_bottom = screen.bottom() - (screen.height() * 0.09).max(56.0);
|
||||
|
||||
if app.fullscreen_queue_open {
|
||||
let right_rect = Rect::from_min_max(
|
||||
Pos2::new(right_left, screen.top() + 56.0),
|
||||
Pos2::new((right_right - 48.0).max(right_left + 120.0), right_bottom),
|
||||
);
|
||||
ctx.draw_text_ellipsis(
|
||||
i18n.queue(),
|
||||
TextStyle::headline(22.0, Color::WHITE.with_alpha_f32(split_t)),
|
||||
|
|
@ -1119,12 +1105,17 @@ pub fn render_fullscreen_player(
|
|||
actions,
|
||||
);
|
||||
} else {
|
||||
let lyr_rect = Rect::from_min_max(
|
||||
Pos2::new(right_left, screen.top() + 32.0),
|
||||
Pos2::new(right_right, right_bottom),
|
||||
);
|
||||
render_fullscreen_sync_lyrics(
|
||||
ctx,
|
||||
app.current_lyrics.as_ref(),
|
||||
tr,
|
||||
position_ms,
|
||||
right_rect,
|
||||
is_playing,
|
||||
lyr_rect,
|
||||
bg_color,
|
||||
split_t,
|
||||
ru,
|
||||
|
|
@ -1133,13 +1124,41 @@ pub fn render_fullscreen_player(
|
|||
);
|
||||
}
|
||||
}
|
||||
// Bottom-right Volume / Mute button with upward 44×216 `ym_volume_capsule` hover popover!
|
||||
// Smoothly shifts into the left player column when `split_t > 0` so neither the button nor
|
||||
// its upward popover ever collides with `right_rect` (SyncLyrics / Queue split pane).
|
||||
let vol_x_centered = screen.right() - 44.0;
|
||||
let vol_x_split = (screen.left() + screen.width() * 0.48 - 34.0).max(screen.left() + 44.0);
|
||||
let vol_x = vol_x_centered + (vol_x_split - vol_x_centered) * split_t;
|
||||
let vol_center = Pos2::new(vol_x, screen.bottom() - 44.0);
|
||||
} // end `if let Some(tr) = track`
|
||||
|
||||
// Top-right circular `v` collapse button (`FullscreenPlayerDesktop_closeButton`, z-index: header)
|
||||
let close_r = Rect::from_center_size(
|
||||
Pos2::new(screen.right() - 44.0, screen.top() + 56.0),
|
||||
Vec2::splat(40.0),
|
||||
);
|
||||
let close_resp = ctx.interact(WidgetId::new("fs_close"), close_r);
|
||||
ctx.dl().push_circle(
|
||||
close_r.center(),
|
||||
if close_resp.hovered { 21.0 } else { 20.0 },
|
||||
if close_resp.hovered {
|
||||
css_rgba(255, 255, 255, 36)
|
||||
} else {
|
||||
css_rgba(255, 255, 255, 22)
|
||||
},
|
||||
);
|
||||
ctx.draw_icon(
|
||||
Icon::ArrowDown,
|
||||
Rect::from_center_size(close_r.center(), Vec2::splat(24.0)),
|
||||
Color::WHITE,
|
||||
);
|
||||
if close_resp.hovered {
|
||||
ctx.set_cursor(CursorKind::Pointer);
|
||||
ctx.show_tooltip(close_r, i18n.close());
|
||||
}
|
||||
if close_resp.clicked {
|
||||
actions.push(AppAction::SetFullscreen(false));
|
||||
}
|
||||
|
||||
if track.is_none() {
|
||||
return;
|
||||
}
|
||||
// Bottom-right Volume / Mute button anchored cleanly at bottom-right aligned with top-right `v`!
|
||||
let vol_center = Pos2::new(screen.right() - 44.0, screen.bottom() - 40.0);
|
||||
let vol_btn_r = Rect::from_center_size(vol_center, Vec2::splat(40.0));
|
||||
let vol_resp = ctx.interact(WidgetId::new("fs_vol_btn"), vol_btn_r);
|
||||
let vol_val = app.config.volume;
|
||||
|
|
@ -1207,12 +1226,19 @@ pub fn render_fullscreen_player(
|
|||
});
|
||||
}
|
||||
|
||||
/// 1-to-1 Official `SyncLyrics` (`83ceed5f9f3f6e01.css` + `9631.422e0bf38581fe75.js`):
|
||||
/// - `40vh` active anchor, `32px` Swiper spacing, `base_sz` `(2.5vw clamped 32..48px)`, `scale(1.2)` active line
|
||||
/// - `INTRO` 4 staggered pulsing dots + `PREPARE` `3/2/1` countdown slot above line 0
|
||||
/// - `withVisibleUpperLyrics` (3s on mouse move) & `withVisibleScrolledLyrics` (3s on wheel scroll)
|
||||
/// - Exact opacity ladder (`1.0` active, `0.30` next, `0.10` upcoming / upper-visible, `0.0` hidden past)
|
||||
/// - Official `SyncLyricsFooter` (`Авторы:` / `Writers:` + `Источник:` / `Source:`) + `80px` top/bottom fades
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn render_fullscreen_sync_lyrics(
|
||||
ctx: &mut UiContext,
|
||||
lyrics: Option<&TrackLyrics>,
|
||||
track: &Track,
|
||||
position_ms: u64,
|
||||
is_playing: bool,
|
||||
lyr_rect: Rect,
|
||||
bg_color: Color,
|
||||
split_t: f32,
|
||||
|
|
@ -1224,6 +1250,8 @@ fn render_fullscreen_sync_lyrics(
|
|||
shell.fs_lyrics_track_id = track.id.clone();
|
||||
shell.fs_lyrics_scroll_y = 0.0;
|
||||
shell.fs_lyrics_manual_until = 0.0;
|
||||
shell.fs_lyrics_upper_until = 0.0;
|
||||
shell.fs_lyrics_last_mouse = None;
|
||||
}
|
||||
|
||||
let Some(lyr) = lyrics.filter(|l| !l.lines.is_empty()) else {
|
||||
|
|
@ -1241,52 +1269,85 @@ fn render_fullscreen_sync_lyrics(
|
|||
return;
|
||||
};
|
||||
|
||||
let active_idx = if lyr.is_synced {
|
||||
lyr.lines
|
||||
.iter()
|
||||
.rposition(|l| l.time_ms <= position_ms)
|
||||
.unwrap_or(0)
|
||||
let screen = ctx.screen_rect();
|
||||
let screen_w = screen.width();
|
||||
let base_sz = (screen_w * 0.025).clamp(32.0, 48.0).round();
|
||||
let active_sz = (base_sz * 1.2).round();
|
||||
let base_lh = (base_sz * 1.25).round();
|
||||
let active_lh = (active_sz * 1.25).round();
|
||||
let max_line_w = (lyr_rect.width() * 0.80).max(200.0);
|
||||
let line_gap = 32.0f32; // exact Swiper `spaceBetween: 32`
|
||||
|
||||
// Exact `--sync-lyrics-scroller-inset-top-vh: 40vh` anchor
|
||||
let anchor_y = (screen.top() + screen.height() * 0.40)
|
||||
.clamp(lyr_rect.top() + 48.0, lyr_rect.bottom() - 80.0);
|
||||
|
||||
// Exact state machine: INTRO / PREPARE / PLAYING
|
||||
let start_ms = lyr.lines.first().map_or(0, |l| l.time_ms);
|
||||
let is_prepare = lyr.is_synced
|
||||
&& start_ms >= 3000
|
||||
&& position_ms < start_ms
|
||||
&& (start_ms - position_ms) <= 3000;
|
||||
let is_intro = lyr.is_synced && start_ms > 0 && position_ms < start_ms && !is_prepare;
|
||||
let active_idx: Option<usize> = if lyr.is_synced && !is_intro && !is_prepare {
|
||||
lyr.lines.iter().rposition(|l| l.time_ms <= position_ms)
|
||||
} else {
|
||||
usize::MAX
|
||||
None
|
||||
};
|
||||
|
||||
let screen_w = ctx.screen_rect().width();
|
||||
let base_sz = (screen_w * 0.022).clamp(24.0, 32.0);
|
||||
let active_sz = base_sz * 1.15;
|
||||
let max_line_w = (lyr_rect.width() - 48.0).max(200.0);
|
||||
|
||||
// Pre-measure lines
|
||||
// Pre-measure every line at fixed `base_sz` / `base_lh` (zero wrap-jumping during `scale(1.2)`)
|
||||
let measure_style = TextStyle::headline(base_sz, Color::WHITE).with_line_height(base_lh);
|
||||
let mut line_heights = Vec::with_capacity(lyr.lines.len());
|
||||
let mut line_y = Vec::with_capacity(lyr.lines.len());
|
||||
let mut cur_y = 0.0f32;
|
||||
for (i, line) in lyr.lines.iter().enumerate() {
|
||||
let is_active = i == active_idx;
|
||||
let sz = if is_active { active_sz } else { base_sz };
|
||||
for line in &lyr.lines {
|
||||
let txt = if line.text.trim().is_empty() {
|
||||
"• • •"
|
||||
} else {
|
||||
line.text.as_str()
|
||||
};
|
||||
let measured = ctx.measure_text(txt, TextStyle::headline(sz, Color::WHITE), Some(max_line_w));
|
||||
let h = measured.y.max(sz * 1.25);
|
||||
let measured = ctx.measure_text(txt, measure_style, Some(max_line_w));
|
||||
let h = measured.y.max(base_lh);
|
||||
line_y.push(cur_y + h * 0.5);
|
||||
line_heights.push(h);
|
||||
cur_y += h + 22.0;
|
||||
cur_y += h + line_gap;
|
||||
}
|
||||
let total_h = cur_y;
|
||||
let counter_y = -(line_gap + 22.0);
|
||||
let min_scroll = if is_intro || is_prepare { counter_y } else { 0.0 };
|
||||
|
||||
let now_t = ctx.input.time;
|
||||
let dt = ctx.input.dt;
|
||||
|
||||
// Mouse movement (`> 2px`) reveals past upper lines for 3s (`withVisibleUpperLyrics`)
|
||||
if let Some(pos) = ctx.input.pointer_pos {
|
||||
if let Some(prev) = shell.fs_lyrics_last_mouse {
|
||||
if pos.distance(prev) > 2.0 {
|
||||
shell.fs_lyrics_upper_until = now_t + 3.0;
|
||||
shell.fs_lyrics_last_mouse = Some(pos);
|
||||
}
|
||||
} else {
|
||||
shell.fs_lyrics_last_mouse = Some(pos);
|
||||
}
|
||||
}
|
||||
|
||||
// Wheel scroll enters manual browse mode for 3s (`withVisibleScrolledLyrics`)
|
||||
let wheel_dy = if ctx.is_hovered(lyr_rect) {
|
||||
ctx.input.wheel_delta.y
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
if wheel_dy.abs() > 0.25 {
|
||||
shell.fs_lyrics_scroll_y = (shell.fs_lyrics_scroll_y - wheel_dy).clamp(0.0, total_h.max(0.0));
|
||||
shell.fs_lyrics_scroll_y = (shell.fs_lyrics_scroll_y - wheel_dy).clamp(min_scroll, total_h.max(0.0));
|
||||
shell.fs_lyrics_manual_until = now_t + 3.0;
|
||||
} else if lyr.is_synced && active_idx < line_y.len() && now_t >= shell.fs_lyrics_manual_until {
|
||||
let target_y = line_y[active_idx];
|
||||
} else if lyr.is_synced && now_t >= shell.fs_lyrics_manual_until {
|
||||
let target_y = if is_intro || is_prepare {
|
||||
counter_y
|
||||
} else if let Some(act) = active_idx {
|
||||
line_y[act]
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
let alpha = 1.0 - (-dt * 7.5).exp();
|
||||
shell.fs_lyrics_scroll_y += (target_y - shell.fs_lyrics_scroll_y) * alpha;
|
||||
if (target_y - shell.fs_lyrics_scroll_y).abs() > 0.4 {
|
||||
|
|
@ -1295,82 +1356,190 @@ fn render_fullscreen_sync_lyrics(
|
|||
}
|
||||
|
||||
let manual_scrolled = now_t < shell.fs_lyrics_manual_until;
|
||||
let center_y = lyr_rect.center_y();
|
||||
let upper_visible = now_t < shell.fs_lyrics_upper_until;
|
||||
let lyr_cx = lyr_rect.center_x();
|
||||
|
||||
ctx.push_clip(lyr_rect, 0.0);
|
||||
|
||||
// Counter / Loader slot above line 0 (`INTRO`: 4 staggered pulsing dots; `PREPARE`: "3"/"2"/"1")
|
||||
if is_intro || is_prepare {
|
||||
let cy_screen = anchor_y + (counter_y - shell.fs_lyrics_scroll_y);
|
||||
if cy_screen >= lyr_rect.top() - 40.0 && cy_screen <= lyr_rect.bottom() + 40.0 {
|
||||
if is_prepare {
|
||||
let rem_ms = start_ms.saturating_sub(position_ms);
|
||||
let digit = ((rem_ms.saturating_sub(1)) / 1000 + 1).clamp(1, 3);
|
||||
ctx.draw_text_ellipsis(
|
||||
&digit.to_string(),
|
||||
TextStyle::headline(base_sz, Color::WHITE.with_alpha_f32(0.50 * split_t)),
|
||||
Rect::from_center_size(Pos2::new(lyr_cx, cy_screen), Vec2::new(80.0, base_lh)),
|
||||
TextAlign::Center,
|
||||
);
|
||||
} else {
|
||||
let spacing = 20.0f32;
|
||||
let start_x = lyr_cx - spacing * 1.5;
|
||||
for k in 0..4 {
|
||||
let (dy, dot_a) = if is_playing {
|
||||
let phase = (now_t as f32 * 4.2 - k as f32 * 0.55).sin();
|
||||
(-phase.max(0.0) * 6.0, (0.30 + 0.55 * (phase * 0.5 + 0.5)) * split_t)
|
||||
} else {
|
||||
(0.0, 0.35 * split_t)
|
||||
};
|
||||
ctx.dl().push_circle(
|
||||
Pos2::new(start_x + k as f32 * spacing, cy_screen + dy),
|
||||
5.5,
|
||||
Color::WHITE.with_alpha_f32(dot_a),
|
||||
);
|
||||
}
|
||||
if is_playing {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i, line) in lyr.lines.iter().enumerate() {
|
||||
let y_screen = center_y + (line_y[i] - shell.fs_lyrics_scroll_y);
|
||||
let y_screen = anchor_y + (line_y[i] - shell.fs_lyrics_scroll_y);
|
||||
let h = line_heights[i];
|
||||
if y_screen + h * 0.5 < lyr_rect.top() - 40.0 || y_screen - h * 0.5 > lyr_rect.bottom() + 40.0 {
|
||||
let is_active = !manual_scrolled && active_idx == Some(i);
|
||||
|
||||
let target_op: f32 = if !lyr.is_synced || manual_scrolled {
|
||||
1.0
|
||||
} else if is_intro || is_prepare {
|
||||
if i == 0 { 0.30 } else { 0.10 }
|
||||
} else if let Some(act) = active_idx {
|
||||
if i == act {
|
||||
1.0
|
||||
} else if i == act + 1 {
|
||||
0.30
|
||||
} else if i > act + 1 {
|
||||
0.10
|
||||
} else if upper_visible {
|
||||
0.10
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
} else {
|
||||
0.10
|
||||
};
|
||||
|
||||
let op_t = ctx.animate_f32(WidgetId::from_pair("fs_lyr_op", i), target_op, 0.45);
|
||||
let act_t = ctx.animate_bool(WidgetId::from_pair("fs_lyr_act", i), is_active, 0.45);
|
||||
|
||||
if y_screen + h * 0.65 < lyr_rect.top() - 48.0
|
||||
|| y_screen - h * 0.65 > lyr_rect.bottom() + 48.0
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let is_active = i == active_idx;
|
||||
let is_next = active_idx != usize::MAX && i == active_idx + 1;
|
||||
let hit_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 12.0));
|
||||
let line_visible = op_t > 0.02 || manual_scrolled || upper_visible || !lyr.is_synced;
|
||||
let hit_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 14.0));
|
||||
let resp = ctx.interact(WidgetId::from_pair("fs_lyr_ln", i), hit_r);
|
||||
|
||||
let act_t = ctx.animate_bool(WidgetId::from_pair("fs_lyr_act", i), is_active, 0.35);
|
||||
let hov_t = ctx.animate_bool(
|
||||
WidgetId::from_pair("fs_lyr_hov", i),
|
||||
resp.hovered && lyr.is_synced,
|
||||
resp.hovered && lyr.is_synced && line_visible,
|
||||
0.18,
|
||||
);
|
||||
|
||||
let base_alpha = if !lyr.is_synced || manual_scrolled {
|
||||
0.90f32
|
||||
} else if is_next {
|
||||
0.34
|
||||
} else {
|
||||
0.16
|
||||
};
|
||||
let alpha = (base_alpha + (1.0 - base_alpha) * act_t)
|
||||
.max(0.90 * hov_t)
|
||||
* split_t;
|
||||
let sz = base_sz + (active_sz - base_sz) * act_t;
|
||||
let col = Color::WHITE.with_alpha_f32(alpha);
|
||||
let txt = if line.text.trim().is_empty() {
|
||||
"• • •"
|
||||
} else {
|
||||
line.text.as_str()
|
||||
};
|
||||
let alpha = op_t.max(0.85 * hov_t) * split_t;
|
||||
if alpha > 0.005 {
|
||||
let col = Color::WHITE.with_alpha_f32(alpha);
|
||||
let txt = if line.text.trim().is_empty() {
|
||||
"• • •"
|
||||
} else {
|
||||
line.text.as_str()
|
||||
};
|
||||
|
||||
let draw_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 6.0));
|
||||
ctx.draw_text_wrapped(txt, TextStyle::headline(sz, col), draw_r, None, TextAlign::Center);
|
||||
if act_t < 0.01 {
|
||||
ctx.draw_text_wrapped_scaled(
|
||||
txt,
|
||||
TextStyle::headline(base_sz, col).with_line_height(base_lh),
|
||||
Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h)),
|
||||
1.0,
|
||||
TextAlign::Center,
|
||||
);
|
||||
} else {
|
||||
let sc = (1.0 + 0.2 * act_t) / 1.2;
|
||||
ctx.draw_text_wrapped_scaled(
|
||||
txt,
|
||||
TextStyle::headline(active_sz, col).with_line_height(active_lh),
|
||||
Rect::from_center_size(
|
||||
Pos2::new(lyr_cx, y_screen),
|
||||
Vec2::new(max_line_w * 1.2, h * 1.2),
|
||||
),
|
||||
sc,
|
||||
TextAlign::Center,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if lyr.is_synced {
|
||||
if lyr.is_synced && line_visible {
|
||||
if resp.hovered {
|
||||
ctx.set_cursor(CursorKind::Pointer);
|
||||
}
|
||||
if resp.clicked {
|
||||
actions.push(AppAction::SeekMs(line.time_ms));
|
||||
actions.push(AppAction::SeekMs(line.time_ms.saturating_add(10)));
|
||||
shell.fs_lyrics_manual_until = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Writers footer
|
||||
if let Some(ref writers) = lyr.writers {
|
||||
let fy = center_y + (total_h + 24.0 - shell.fs_lyrics_scroll_y);
|
||||
if fy >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
|
||||
// Official `SyncLyricsFooter`: Writers + Source (`major`) attribution at `0.50` alpha
|
||||
let has_writers = lyr.writers.as_deref().map_or(false, |s| !s.trim().is_empty());
|
||||
let has_major = lyr.major.as_deref().map_or(false, |s| !s.trim().is_empty());
|
||||
if has_writers || has_major {
|
||||
let footer_pad_top = (screen_w * 0.0625).clamp(48.0, 96.0);
|
||||
let footer_sz = (screen_w * 0.0125).clamp(15.0, 20.0);
|
||||
let footer_col = Color::WHITE.with_alpha_f32(0.50 * split_t);
|
||||
let footer_style = TextStyle::medium(footer_sz, footer_col);
|
||||
let mut fy = anchor_y + (total_h + footer_pad_top - shell.fs_lyrics_scroll_y);
|
||||
|
||||
if let Some(ref writers) = lyr.writers.as_deref().filter(|s| !s.trim().is_empty()) {
|
||||
let txt = if ru {
|
||||
format!("Авторы: {}", writers)
|
||||
} else {
|
||||
format!("Writers: {}", writers)
|
||||
};
|
||||
ctx.draw_text_wrapped(
|
||||
&txt,
|
||||
TextStyle::regular(14.0, Color::WHITE.with_alpha_f32(0.5 * split_t)),
|
||||
Rect::from_center_size(Pos2::new(lyr_cx, fy), Vec2::new(max_line_w, 40.0)),
|
||||
Some(2),
|
||||
TextAlign::Center,
|
||||
);
|
||||
let mh = ctx
|
||||
.measure_text(&txt, footer_style, Some(max_line_w))
|
||||
.y
|
||||
.max(footer_sz * 1.35);
|
||||
if fy + mh >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
|
||||
ctx.draw_text_wrapped(
|
||||
&txt,
|
||||
footer_style,
|
||||
Rect::from_xywh(lyr_cx - max_line_w * 0.5, fy, max_line_w, mh + 4.0),
|
||||
Some(3),
|
||||
TextAlign::Center,
|
||||
);
|
||||
}
|
||||
fy += mh + 8.0;
|
||||
}
|
||||
|
||||
if let Some(ref major) = lyr.major.as_deref().filter(|s| !s.trim().is_empty()) {
|
||||
let txt = if ru {
|
||||
format!("Источник: {}", major)
|
||||
} else {
|
||||
format!("Source: {}", major)
|
||||
};
|
||||
let mh = ctx
|
||||
.measure_text(&txt, footer_style, Some(max_line_w))
|
||||
.y
|
||||
.max(footer_sz * 1.35);
|
||||
if fy + mh >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
|
||||
ctx.draw_text_wrapped(
|
||||
&txt,
|
||||
footer_style,
|
||||
Rect::from_xywh(lyr_cx - max_line_w * 0.5, fy, max_line_w, mh + 4.0),
|
||||
Some(2),
|
||||
TextAlign::Center,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Smooth top & bottom gradient fade masks into `bg_color`
|
||||
let fade_h = 84.0f32.min(lyr_rect.height() * 0.22);
|
||||
// Official `80px` (`5rem`) top & bottom gradient fade masks into `bg_color`
|
||||
let fade_h = 80.0f32.min(lyr_rect.height() * 0.25);
|
||||
let bg_clear = bg_color.with_alpha(0);
|
||||
ctx.dl().push_gradient_rect(
|
||||
Rect::from_xywh(lyr_rect.left(), lyr_rect.top(), lyr_rect.width(), fade_h),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue