Fix UI overlay scale factor for readable display on iOS devices (#1142)

This commit is contained in:
SRSaunders 2024-06-21 01:50:07 -04:00 committed by GitHub
parent a9a1b95e2f
commit cc2c05ba45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,9 +36,11 @@ CALayer* layer;
layer = [self.view layer]; // SRS - When creating a Vulkan Metal surface, need the layer backing the view layer = [self.view layer]; // SRS - When creating a Vulkan Metal surface, need the layer backing the view
self.view.contentScaleFactor = UIScreen.mainScreen.nativeScale; layer.contentsScale = UIScreen.mainScreen.nativeScale;
_mvkExample = new MVKExample(self.view, 1.0f); // SRS - Use 1x scale factor for UIOverlay on iOS // SRS - Calculate UI overlay scale factor based on backing layer scale factor and device type for readable UIOverlay on iOS devices
auto UIOverlayScale = layer.contentsScale * ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone ? 2.0/3.0 : 1.0 );
_mvkExample = new MVKExample(self.view, UIOverlayScale);
// SRS - Enable AppDelegate to call into DemoViewController for handling app lifecycle events (e.g. termination) // SRS - Enable AppDelegate to call into DemoViewController for handling app lifecycle events (e.g. termination)
auto appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate; auto appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate;