diff --git a/apps/game/src/edit/roads.rs b/apps/game/src/edit/roads.rs index 6c0e57abb2..cca6f9cd29 100644 --- a/apps/game/src/edit/roads.rs +++ b/apps/game/src/edit/roads.rs @@ -830,12 +830,7 @@ fn make_main_panel( Distance::meters(0.1), // Even if the user's settings are set to feet, our step size is in meters, so // just render in meters. - Box::new(|x| { - x.to_string(&UnitFmt { - round_durations: false, - metric: true, - }) - }), + Box::new(|x| x.to_string(&UnitFmt::metric())), ), ]) .section(ctx), diff --git a/apps/game/src/ungap/predict.rs b/apps/game/src/ungap/predict.rs index 0380337365..39f7251845 100644 --- a/apps/game/src/ungap/predict.rs +++ b/apps/game/src/ungap/predict.rs @@ -282,12 +282,7 @@ impl Filters { Distance::meters(1.0), // Even if the user's settings are set to feet, our step size is in meters, so // just render in meters. - Box::new(|x| { - x.to_string(&UnitFmt { - round_durations: false, - metric: true, - }) - }), + Box::new(|x| x.to_string(&UnitFmt::metric())), ), ]), ]) diff --git a/geom/src/lib.rs b/geom/src/lib.rs index 75dbb168f0..71f5639057 100644 --- a/geom/src/lib.rs +++ b/geom/src/lib.rs @@ -73,6 +73,16 @@ pub struct UnitFmt { pub metric: bool, } +impl UnitFmt { + /// Default settings using metric. + pub fn metric() -> Self { + Self { + round_durations: true, + metric: true, + } + } +} + #[derive(Clone, Copy, Debug)] pub struct CornerRadii { pub top_left: f64, diff --git a/widgetry_demo/src/lib.rs b/widgetry_demo/src/lib.rs index 9db11c73f9..5979e77844 100644 --- a/widgetry_demo/src/lib.rs +++ b/widgetry_demo/src/lib.rs @@ -113,10 +113,7 @@ impl Demo { max_x: Some(Time::START_OF_DAY + self.elapsed), ..Default::default() }, - UnitFmt { - round_durations: true, - metric: true, - }, + UnitFmt::metric(), ), ])) // Don't let the panel exceed this percentage of the window. Scrollbars appear