Basic dynamic text size adjustment if the song title is too long

master
Joey Pollack 2 years ago
parent 18ca480468
commit ff6b697d63

@ -73,9 +73,17 @@ impl eframe::App for JpmmvApp
);
});
let mut title_text_size = 24.0;
let title_len = self.current_metadata.name.len() as f32;
if title_len > 44.0
{
title_text_size -= (title_len as f32 - 44.0) / 2.0;
}
ui.style_mut().text_styles.insert(
egui::TextStyle::Body,
egui::FontId::new(24.0, eframe::epaint::FontFamily::Proportional),
egui::FontId::new(title_text_size, eframe::epaint::FontFamily::Proportional),
);
ui.vertical(|ui| {

@ -52,11 +52,8 @@ pub fn get_song_metadata() -> SongMetadata
sm.album = split[2].to_string();
sm.art_url = split[3].to_string();
sm.art_url = sm.art_url.trim().to_string();
sm.is_playing = if status == "paused" {
false
} else {
true
};
sm.is_playing = if status == "paused" || status == "stopped"
{ false } else { true };
// let test_url = sm.art_url.trim_start_matches("file://").to_string();

Loading…
Cancel
Save