From 58a77ec9fa43b6962e5af3473ba237ec78b08841 Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Fri, 5 Aug 2022 17:55:43 -0400 Subject: [PATCH] properties_view: Only show decimal places when dimensions are fractional --- src/widgets/properties_view.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/widgets/properties_view.rs b/src/widgets/properties_view.rs index 385c496..3cc4c59 100644 --- a/src/widgets/properties_view.rs +++ b/src/widgets/properties_view.rs @@ -263,7 +263,13 @@ impl LpPropertiesView { _ => None::<(f64, f64)>, } }) - .map(|(w, h)| format!("{w:.1} \u{D7} {h:.1}")) + .map(|(w, h)| { + if w.fract() != 0.0 || h.fract() != 0.0 { + format!("{w:.1} \u{D7} {h:.1}") + } else { + format!("{w} \u{D7} {h}") + } + }) } else { gdk_pixbuf::Pixbuf::file_info_future(path.unwrap()) .await