pub struct Factor(pub f64); mod ns_window { // use objc2_ui_kit::UIWindow; // impl From<&UIWindow> for super::Factor { // fn from(value: &UIWindow) -> Self { // Self(value.contentScaleFactor()) // } // } use super::super::XLoopView; impl From<&XLoopView> for super::Factor { fn from(value: &XLoopView) -> Self { Self(value.contentScaleFactor()) } } } 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 } }