pub struct Factor(pub f64); mod ns_window { use objc2_app_kit::NSWindow; impl From<&NSWindow> for super::Factor { fn from(value: &NSWindow) -> Self { Self(value.backingScaleFactor()) } } } impl Factor { pub fn to_u32(&self, value: f64) -> u32 { (value * self.0).round() as u32 } pub fn to_f32(&self, value: f64) -> f32 { (value * self.0) as f32 } pub fn as_f32(&self) -> f32 { self.0 as f32 } }