Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loupe has gray corners in macOS 10.15 Catalina #124

Open
DavidPhillipOster opened this issue Nov 14, 2019 · 1 comment
Open

Loupe has gray corners in macOS 10.15 Catalina #124

DavidPhillipOster opened this issue Nov 14, 2019 · 1 comment

Comments

@DavidPhillipOster
Copy link

To fix this, (1 of 3) in TSSTInfoWindow.h , change:

@interface TSSTInfoWindow : NSPanel {}

to

@interface TSSTOuterInfoView : NSView {
  float lastDiameter;
}
- (void)resizeToDiameter:(float)diameter;
@end

@interface TSSTInfoWindow : NSPanel {
  IBOutlet TSSTOuterInfoView *outerView;
}

and (2 of 3) in TSSTInfoWindow.m with the other imports, add:

#import <QuartzCore/CAShapeLayer.h>

in - (void)centerAtPoint:(NSPoint)center add:

 [outerView resizeToDiameter:frame.size.width];

in - (void)resizeToDiameter:(float)diameter
add:

  [outerView resizeToDiameter:diameter];

and above @implementation TSSTInfoView

add

@implementation TSSTOuterInfoView

- (void)awakeFromNib {
  [super awakeFromNib];

  CALayer *baseLayer = [[CALayer alloc] init];
  baseLayer.backgroundColor = NSColor.clearColor.CGColor;
  self.superview.layer = baseLayer;
}

- (void)resizeToDiameter:(float)diameter {
  if (lastDiameter != diameter) {
    CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
    CGPathRef path = CGPathCreateWithEllipseInRect(NSMakeRect(0, 0, diameter, diameter), nil);
    shapeLayer.path = path;
    CGPathRelease(path);
    self.superview.layer.mask = shapeLayer;
    lastDiameter = diameter;
  }
}
@end

(3 of 3): in TSSTSessionWindow.xib, in the Loupe Panel hierarchy, click on the middle View (between the Loupe Panel and the Zoom View, and use the Identity Inspector to change the class from NSView to TSSTOuterInfoView . Control-drag from the Loupe Panel to the Outer View to connect the outerView IBOutlet

This fix uses CoreGraphics Layer Masking to mask the Loupe to just its circular region.

@MaddTheSane
Copy link

It usually helps if you create a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants