Simple-Comic icon indicating copy to clipboard operation
Simple-Comic copied to clipboard

Loupe has gray corners in macOS 10.15 Catalina

Open DavidPhillipOster opened this issue 5 years ago • 1 comments

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.

DavidPhillipOster avatar Nov 14 '19 04:11 DavidPhillipOster

It usually helps if you create a pull request.

MaddTheSane avatar Nov 14 '19 04:11 MaddTheSane