File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Modules/@babylonjs/react-native/ios Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,9 @@ + (void)onBridgeWillInvalidate:(NSNotification*)notification
5555}
5656
5757+ (void )updateView : (MTKView *)mtkView {
58- const int width = static_cast <int >(mtkView.bounds .size .width * UIScreen.mainScreen .scale );
59- const int height = static_cast <int >(mtkView.bounds .size .height * UIScreen.mainScreen .scale );
58+ const CGFloat scale = mtkView.contentScaleFactor ;
59+ const int width = static_cast <int >(mtkView.bounds .size .width * scale);
60+ const int height = static_cast <int >(mtkView.bounds .size .height * scale);
6061 if (width != 0 && height != 0 ) {
6162 Babylon::UpdateView ((__bridge void *)mtkView, width, height);
6263 }
@@ -81,7 +82,7 @@ + (bool)isXRActive {
8182+ (void )reportTouchEvent : (MTKView *)mtkView touches : (NSSet <UITouch*>*)touches event : (UIEvent*)event {
8283 for (UITouch* touch in touches) {
8384 if (touch.view == mtkView) {
84- const CGFloat scale = UIScreen. mainScreen . scale ;
85+ const CGFloat scale = mtkView. contentScaleFactor ;
8586 const CGPoint pointerPosition = [touch locationInView: mtkView];
8687 const uint32_t x = static_cast <uint32_t >(pointerPosition.x * scale);
8788 const uint32_t y = static_cast <uint32_t >(pointerPosition.y * scale);
You can’t perform that action at this time.
0 commit comments