#pragma warning restore 618 // ************************ // Physical vs Logical Rect // ************************ // // On Android. _app.GetRect() will return values in the PHYSICAL coordinate space. // On iOS, _app.GetRect() will return values in the LOGICAL coordinate space. // On Wasm (Browser), _app.GetRect() will be 1:1 for PHYSICAL:LOGICAL, so no need to convert. // // ************************ private static IAppRect ToPhysicalRect(IApp app, IAppRect rect) { return(AppInitializer.GetLocalPlatform() switch { Platform.Android => rect, Platform.iOS => rect.ApplyScale(app.GetDisplayScreenScaling()), Platform.Browser => rect.ApplyScale(app.GetDisplayScreenScaling()), _ => throw new InvalidOperationException("Unknown current platform.") });
public static IAppRect UnapplyScale(this IAppRect rect, float scale) => rect.ApplyScale(1f / scale);