Skip to content

Commit ad6f264

Browse files
authored
Tidy up EngineViewManager.mm
1 parent bd69f69 commit ad6f264

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Modules/@babylonjs/react-native-macos/macos/EngineViewManager.mm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,39 @@ @implementation EngineView {
2222
}
2323

2424
- (instancetype)init:(RCTBridge*)_bridge {
25-
#ifdef TARGET_OS_OSX
26-
const CGSize monitor = [[NSScreen mainScreen] frame].size;
27-
const CGSize appWin = [[NSApp mainWindow] frame].size;
28-
if (self = [super initWithFrame:CGRectMake((appWin.width - monitor.width) / 2, (appWin.height - monitor.height) / 2, monitor.width, monitor.height)
25+
#ifdef TARGET_OS_OSX
26+
const CGSize monitor = [[NSScreen mainScreen] frame].size;
27+
const CGSize appWin = [[NSApp mainWindow] frame].size;
28+
if (self = [super initWithFrame:CGRectMake((appWin.width - monitor.width) / 2, (appWin.height - monitor.height) / 2, monitor.width, monitor.height)
2929
device:MTLCreateSystemDefaultDevice()]) {
3030
bridge = _bridge;
3131
super.translatesAutoresizingMaskIntoConstraints = false;
3232
super.colorPixelFormat = MTLPixelFormatBGRA8Unorm_sRGB;
3333
super.depthStencilPixelFormat = MTLPixelFormatDepth32Float;
3434
}
3535

36-
[self setBounds:CGRectMake((appWin.width - monitor.width) / 2, (appWin.height - monitor.height) / 2, monitor.width, monitor.height)];
37-
#else
38-
if (self = [super initWithFrame:CGRectZero device:MTLCreateSystemDefaultDevice()]) {
36+
[self setBounds:CGRectMake((appWin.width - monitor.width) / 2, (appWin.height - monitor.height) / 2, monitor.width, monitor.height)];
37+
#else
38+
if (self = [super initWithFrame:CGRectZero device:MTLCreateSystemDefaultDevice()]) {
3939
bridge = _bridge;
4040
super.translatesAutoresizingMaskIntoConstraints = false;
4141
super.colorPixelFormat = MTLPixelFormatBGRA8Unorm_sRGB;
4242
super.depthStencilPixelFormat = MTLPixelFormatDepth32Float;
4343
}
44-
#endif
44+
#endif
4545
return self;
4646
}
4747

4848
- (void)setIsTransparentFlag:(NSNumber*)isTransparentFlag {
49-
#ifndef TARGET_OS_OSX
49+
#ifndef TARGET_OS_OSX
5050
BOOL isTransparent = [isTransparentFlag intValue] == 1;
5151
if(isTransparent){
5252
[self setOpaque:NO];
5353
} else {
5454
[self setOpaque:YES];
5555
}
5656
self.isTransparent = isTransparent;
57-
#endif
57+
#endif
5858
}
5959

6060
- (void)setMSAA:(NSNumber*)value {
@@ -99,7 +99,7 @@ - (void)drawRect:(CGRect)rect {
9999
[xrView removeFromSuperview];
100100
xrView = nil;
101101
}
102-
#endif
102+
#endif
103103
[BabylonNativeInterop renderView];
104104
}
105105

@@ -108,7 +108,7 @@ - (void)dealloc {
108108
}
109109

110110
- (void)takeSnapshot {
111-
#ifndef TARGET_OS_OSX
111+
#ifndef TARGET_OS_OSX
112112
// We must take the screenshot on the main thread otherwise we might fail to get a valid handle on the view's image.
113113
dispatch_async(dispatch_get_main_queue(), ^{
114114
// Start the graphics context.
@@ -128,7 +128,7 @@ - (void)takeSnapshot {
128128
self.onSnapshotDataReturned(@{ @"data":encodedData});
129129
}
130130
});
131-
#endif
131+
#endif
132132
}
133133

134134
#ifdef TARGET_OS_OSX

0 commit comments

Comments
 (0)