Minor refactorings

This commit is contained in:
Stephen Seo 2021-09-20 22:08:36 +09:00
parent 92f2a441a4
commit 76372e4f97

View file

@ -928,14 +928,12 @@ async fn main() -> Result<(), String> {
} }
} }
let temp_dim_opt = artist_dim_opt.as_ref().unwrap();
draw_rectangle( draw_rectangle(
TEXT_X_OFFSET, TEXT_X_OFFSET,
prev_height prev_height - temp_offset_y - TEXT_Y_OFFSET - temp_dim_opt.height,
- temp_offset_y temp_dim_opt.width,
- TEXT_Y_OFFSET temp_dim_opt.height,
- artist_dim_opt.as_ref().unwrap().height,
artist_dim_opt.as_ref().unwrap().width,
artist_dim_opt.as_ref().unwrap().height,
Color::new(0.0, 0.0, 0.0, 0.4), Color::new(0.0, 0.0, 0.0, 0.4),
); );
draw_text( draw_text(
@ -946,18 +944,16 @@ async fn main() -> Result<(), String> {
WHITE, WHITE,
); );
temp_offset_y += TEXT_Y_OFFSET + artist_dim_opt.as_ref().unwrap().height; temp_offset_y += TEXT_Y_OFFSET + temp_dim_opt.height;
} }
if !title.is_empty() && !opt.disable_show_title { if !title.is_empty() && !opt.disable_show_title {
let temp_dim_opt = title_dim_opt.as_ref().unwrap();
draw_rectangle( draw_rectangle(
TEXT_X_OFFSET, TEXT_X_OFFSET,
prev_height prev_height - temp_offset_y - TEXT_Y_OFFSET - temp_dim_opt.height,
- temp_offset_y temp_dim_opt.width,
- TEXT_Y_OFFSET temp_dim_opt.height,
- title_dim_opt.as_ref().unwrap().height,
title_dim_opt.as_ref().unwrap().width,
title_dim_opt.as_ref().unwrap().height,
Color::new(0.0, 0.0, 0.0, 0.4), Color::new(0.0, 0.0, 0.0, 0.4),
); );
draw_text( draw_text(
@ -968,7 +964,7 @@ async fn main() -> Result<(), String> {
WHITE, WHITE,
); );
temp_offset_y += TEXT_Y_OFFSET + title_dim_opt.as_ref().unwrap().height; temp_offset_y += TEXT_Y_OFFSET + temp_dim_opt.height;
} }
let timer_string = seconds_to_time(track_timer); let timer_string = seconds_to_time(track_timer);