Idle pill: the words only where they fit with room at both ends, else the note alone, so it never nears the rim
This commit is contained in:
+9
-7
@@ -600,15 +600,17 @@ pub fn faded(color: Color, alpha: u8) -> Color {
|
||||
Color::rgba(color.red(), color.green(), color.blue(), alpha)
|
||||
}
|
||||
|
||||
// the island while no player is open: a music note and "Nothing playing", on the pill's surface
|
||||
// the island while no player is open: a music note and "Nothing playing", on the pill's surface;
|
||||
// the words only where they fit with half the pill's height to spare at each end, else the note alone, so it never nears the rim
|
||||
fn idle(colors: &[Color; 3]) -> Rectangle {
|
||||
let content = Rectangle::new()
|
||||
.width(c::pill::width())
|
||||
.height(c::pill::height())
|
||||
.align_child(Center, Center)
|
||||
.child(Row::new(children![icon(Glyph::Note, 15.0, theme::now().accent), Text::new("Nothing playing").size(text::body()).color(theme::now().dim)]).gap(8.0).align(Center));
|
||||
let (width, h, note) = (c::pill::width(), c::pill::height(), 15.0);
|
||||
let words = Text::new("Nothing playing").size(text::body()).color(theme::now().dim);
|
||||
let fits = matches!(words.width(), amane::Size::Fixed(words_w) if note + 8.0 + words_w + h <= width);
|
||||
|
||||
surface::shell(c::pill::width(), c::pill::height(), c::pill::height() / 2.0, colors, 0.0, content)
|
||||
let row = if fits { Row::new(children![icon(Glyph::Note, note, theme::now().accent), words]) } else { Row::new(children![icon(Glyph::Note, note, theme::now().accent)]) };
|
||||
let content = Rectangle::new().width(width).height(h).align_child(Center, Center).child(row.gap(8.0).align(Center));
|
||||
|
||||
surface::shell(width, h, h / 2.0, colors, 0.0, content)
|
||||
}
|
||||
|
||||
// the pill: cover, title, the player's live levels
|
||||
|
||||
Reference in New Issue
Block a user