fix(app): Grid mode no longer paints thumbnail twice; drop unused ThemeAccents::LEGACY
This commit is contained in:
parent
29d449eb9b
commit
5091d0de96
2 changed files with 5 additions and 45 deletions
39
src/app.rs
39
src/app.rs
|
|
@ -4416,37 +4416,8 @@ impl App {
|
||||||
let mut toggle_flag_card: Option<&'static str> = None;
|
let mut toggle_flag_card: Option<&'static str> = None;
|
||||||
|
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
let (rect, resp) = ui.allocate_exact_size(
|
// `render_row_body` owns the thumbnail + rings + clicks,
|
||||||
egui::vec2(thumb_w, thumb_h),
|
// so the grid just lays out title/meta below it.
|
||||||
egui::Sense::click(),
|
|
||||||
);
|
|
||||||
let texture = card.thumb_path.as_ref().and_then(|p| self.texture(ctx, p));
|
|
||||||
match &texture {
|
|
||||||
Some(handle) => {
|
|
||||||
egui::Image::new(handle)
|
|
||||||
.maintain_aspect_ratio(true)
|
|
||||||
.paint_at(ui, rect);
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
self.paint_thumb_placeholder(ui, rect, "🎬", density);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if selected {
|
|
||||||
ui.painter().rect_stroke(rect, 4.0, egui::Stroke::new(2.0, self.theme_accents.accent));
|
|
||||||
}
|
|
||||||
if is_playing {
|
|
||||||
ui.painter().rect_stroke(rect, 4.0, egui::Stroke::new(2.0, self.theme_accents.success));
|
|
||||||
}
|
|
||||||
if bulk_checked {
|
|
||||||
ui.painter().rect_stroke(rect, 4.0, egui::Stroke::new(3.0, self.theme_accents.warning));
|
|
||||||
}
|
|
||||||
if resp.clicked() {
|
|
||||||
clicked_card = true;
|
|
||||||
}
|
|
||||||
if resp.double_clicked() {
|
|
||||||
play_card = true;
|
|
||||||
}
|
|
||||||
ui.add_space(4.0);
|
|
||||||
self.render_row_body(
|
self.render_row_body(
|
||||||
ui, ctx, card, density, egui::vec2(thumb_w, thumb_h), show_channel,
|
ui, ctx, card, density, egui::vec2(thumb_w, thumb_h), show_channel,
|
||||||
selected, is_playing, bulk_checked,
|
selected, is_playing, bulk_checked,
|
||||||
|
|
@ -4464,9 +4435,9 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The thumbnail + metadata + flag-button body shared by List/Card/Grid.
|
/// The thumbnail + metadata + flag-button body shared by List/Card/Grid.
|
||||||
/// In List/Card it's laid out inside an existing horizontal; in Grid the
|
/// Owns the thumbnail paint, selection/playing/bulk rings, watched
|
||||||
/// thumbnail is already painted by the caller, so `thumb_size` is only
|
/// banner, and click/double-click sensing. Callers lay out the cell
|
||||||
/// used here for the watched banner placement (Grid passes its own).
|
/// (horizontal for List/Card, vertical for Grid) and pass `thumb_size`.
|
||||||
fn render_row_body(
|
fn render_row_body(
|
||||||
&mut self,
|
&mut self,
|
||||||
ui: &mut egui::Ui,
|
ui: &mut egui::Ui,
|
||||||
|
|
|
||||||
11
src/theme.rs
11
src/theme.rs
|
|
@ -39,17 +39,6 @@ pub struct ThemeAccents {
|
||||||
pub warning: Color32,
|
pub warning: Color32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThemeAccents {
|
|
||||||
/// The stock fallback used before theme-specific accents are wired in.
|
|
||||||
/// Matches the legacy hardcoded values so behavior is unchanged when a
|
|
||||||
/// theme has not yet defined its own.
|
|
||||||
pub const LEGACY: ThemeAccents = ThemeAccents {
|
|
||||||
accent: Color32::from_rgb(120, 170, 230),
|
|
||||||
success: Color32::from_rgb(110, 200, 110),
|
|
||||||
warning: Color32::from_rgb(180, 130, 240),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Look up the semantic accents for a theme name. Falls back to the dark
|
/// Look up the semantic accents for a theme name. Falls back to the dark
|
||||||
/// theme's accents for unknown names.
|
/// theme's accents for unknown names.
|
||||||
pub fn accents_for(name: &str) -> ThemeAccents {
|
pub fn accents_for(name: &str) -> ThemeAccents {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue