Skip to content

Commit

Permalink
Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed Oct 1, 2021
1 parent 3b91b45 commit afda944
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions SquirrelPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ - (instancetype)init {
if (@available(macOS 10.14, *)) {
_back = [[NSVisualEffectView alloc] init];
_back.blendingMode = NSVisualEffectBlendingModeBehindWindow;
_back.material = NSVisualEffectMaterialFullScreenUI;
_back.material = NSVisualEffectMaterialHUDWindow;
_back.state = NSVisualEffectStateActive;
_back.wantsLayer = YES;
_back.layer.mask = _view.shape;
Expand Down Expand Up @@ -1034,37 +1034,25 @@ - (void)show {
windowRect.origin.y = NSMinY(_screenRect);
}
[self setFrame:windowRect display:YES];
// rotate the view, the core in vertical mode!
if (theme.vertical) {
self.contentView.boundsRotation = -90.0;
[self.contentView setBoundsOrigin:NSMakePoint(0, windowRect.size.width)];
} else {
self.contentView.boundsRotation = 0;
[self.contentView setBoundsOrigin:NSMakePoint(0, 0)];
}
BOOL translucency = theme.translucency;
[_view setFrame:_view.superview.bounds];
[_view setFrame:self.contentView.bounds];
if (@available(macOS 10.14, *)) {
if (translucency) {
[_back setFrame:_back.superview.bounds];
[_back setFrame:self.contentView.bounds];
_back.appearance = NSApp.effectiveAppearance;
[_back setHidden:NO];
} else {
[_back setHidden:YES];
}
}
// rotate the view, the core in vertical mode!
if (theme.vertical) {
_view.boundsRotation = 90.0;
[_view setBoundsOrigin:NSMakePoint(0, windowRect.size.width)];
if (@available(macOS 10.14, *)) {
if (translucency) {
_back.boundsRotation = 90.0;
[_back setBoundsOrigin:NSMakePoint(0, windowRect.size.width)];
}
}
} else {
_view.boundsRotation = 0;
[_view setBoundsOrigin:NSMakePoint(0, 0)];
if (@available(macOS 10.14, *)) {
if (translucency) {
_back.boundsRotation = 0;
[_back setBoundsOrigin:NSMakePoint(0, 0)];
}
}
}
self.alphaValue = theme.alpha;
[self invalidateShadow];
[self orderFront:nil];
Expand Down

0 comments on commit afda944

Please sign in to comment.