Add rounding to volume percentage display
Shows percentage is sometimes lower than actual because float number is cast to u16 without rounding, so for example 4.99_f64 becomes 4_u16
This commit is contained in:
committed by
Henrik Friedrichsen
parent
c44644db8a
commit
aa8e9f1099
@@ -125,7 +125,7 @@ impl View for StatusBar {
|
||||
|
||||
let volume = format!(
|
||||
" [{}%]",
|
||||
(self.spotify.volume() as f64 / 65535_f64 * 100.0) as u16
|
||||
(self.spotify.volume() as f64 / 65535_f64 * 100.0).round() as u16
|
||||
);
|
||||
|
||||
printer.with_color(style_bar_bg, |printer| {
|
||||
|
||||
Reference in New Issue
Block a user