Skip to content

Commit

Permalink
Experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Sep 9, 2024
1 parent 032561b commit 229253a
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions psst-gui/src/ui/track.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::sync::Arc;

use druid::{
widget::{CrossAxisAlignment, Either, Flex, Label, LineBreaking, ViewSwitcher},
LensExt, LocalizedString, Menu, MenuItem, Size, TextAlignment, Widget, WidgetExt,
piet::UnitPoint,
widget::{CrossAxisAlignment, Either, Flex, Label, LineBreaking, Painter, ViewSwitcher},
LensExt, LocalizedString, Menu, MenuItem, RenderContext, Size, TextAlignment, Widget,
WidgetExt,
};
use psst_core::{
audio::normalize::NormalizationLevel,
Expand All @@ -17,7 +19,7 @@ use crate::{
RecommendationsRequest, Track,
},
ui::playlist,
widget::{icons, Empty, MyWidgetExt, RemoteImage},
widget::{icons, Empty, MyWidgetExt, Overlay, RemoteImage},
};

use super::{
Expand Down Expand Up @@ -76,17 +78,24 @@ pub fn playable_widget(track: &Track, display: Display) -> impl Widget<PlayRow<A
));
}

fn title_with_marker() -> impl Widget<PlayRow<Arc<Track>>> {
let marker = playable::is_playing_marker_widget()
.lens(PlayRow::is_playing)
.expand_width()
.fix_height(8.0); // Adjust this value to visually confirm centering

let title = Label::raw()
.with_font(theme::UI_FONT_MEDIUM)
.with_line_break_mode(LineBreaking::Clip)
.lens(PlayRow::item.then(Track::name.in_arc()));

Overlay::bottom(marker, title)
.align_vertical(UnitPoint::CENTER)
.expand_width()
}

let mut title_row = Flex::row()
.with_flex_child(
Label::raw()
.with_font(theme::UI_FONT_MEDIUM)
.with_line_break_mode(LineBreaking::Clip)
.lens(PlayRow::item.then(Track::name.in_arc()))
.expand_width(),
1.0,
)
.with_default_spacer()
// .with_child(playable::is_playing_marker_widget().lens(PlayRow::is_playing))
.with_flex_child(title_with_marker(), 1.0)
.with_default_spacer()
.must_fill_main_axis(true);

Expand Down

0 comments on commit 229253a

Please sign in to comment.