From b42aaeb35ad2238900f4b88b2a78b26d70bce2de Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 10 Jan 2022 21:37:43 +0900 Subject: [PATCH] Replace magic number with const, bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 2 +- src/display.rs | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38f9046..ed7865c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1427,7 +1427,7 @@ dependencies = [ [[package]] name = "mpd_info_screen" -version = "0.2.9" +version = "0.2.10" dependencies = [ "ggez", "image", diff --git a/Cargo.toml b/Cargo.toml index 970e913..b7263fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mpd_info_screen" -version = "0.2.9" +version = "0.2.10" edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index ae80447..c787ddb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ counter, and the filename currently being played # Usage - mpd_info_screen 0.2.9 + mpd_info_screen 0.2.10 USAGE: mpd_info_screen [FLAGS] [OPTIONS] [port] diff --git a/src/display.rs b/src/display.rs index be98887..594d998 100644 --- a/src/display.rs +++ b/src/display.rs @@ -22,6 +22,7 @@ const TEXT_OFFSET_Y_SPACING: f32 = 0.4; const TEXT_HEIGHT_SCALE: f32 = 0.1; const ARTIST_HEIGHT_SCALE: f32 = 0.08; const TIMER_HEIGHT_SCALE: f32 = 0.07; +const MIN_WIDTH_RATIO: f32 = 4.0 / 5.0; fn seconds_to_time(seconds: f64) -> String { let seconds_int: u64 = seconds.floor() as u64; @@ -278,7 +279,7 @@ impl MPDDisplay { current_x = current_x * 4.0f32 / 5.0f32; current_y = current_y * 4.0f32 / 5.0f32; continue; - } else if screen_coords.w * 2.0 / 3.0 > width { + } else if screen_coords.w * MIN_WIDTH_RATIO > width { current_x = current_x * 5.0f32 / 4.0f32; current_y = current_y * 5.0f32 / 4.0f32; continue;