@@ -12,6 +12,7 @@ class TrafficLightButton: NSButton {
1212 target = self
1313 action = #selector( onClick)
1414 fit ( size, size)
15+ addTrackingArea ( NSTrackingArea ( rect: bounds, options: [ . mouseEnteredAndExited, . activeInKeyWindow] , owner: self , userInfo: nil ) )
1516 }
1617
1718 required init ? ( coder: NSCoder ) {
@@ -28,10 +29,6 @@ class TrafficLightButton: NSButton {
2829 }
2930 }
3031
31- override func updateTrackingAreas( ) {
32- addTrackingArea ( NSTrackingArea ( rect: bounds, options: [ . activeInActiveApp, . mouseEnteredAndExited, . assumeInside, . inVisibleRect] , owner: self , userInfo: nil ) )
33- }
34-
3532 override func mouseEntered( with event: NSEvent ) {
3633 isMouseOver = true
3734 setNeedsDisplay ( )
@@ -90,6 +87,7 @@ class TrafficLightButton: NSButton {
9087 }
9188
9289 private func drawDimming( _ disk: NSBezierPath ) {
90+ disk. lineWidth = 1
9391 if ( isHighlighted) {
9492 NSColor ( calibratedRed: 0 , green: 0 , blue: 0 , alpha: 0.5 ) . setFill ( )
9593 disk. fill ( )
@@ -102,7 +100,7 @@ class TrafficLightButton: NSButton {
102100 private func drawDisk( _ backgroundGradient: NSGradient , _ strokeColor: NSColor ) -> NSBezierPath {
103101 var disk = NSBezierPath ( )
104102 disk. appendOval ( in: NSMakeRect ( bounds. origin. x + 0.5 , bounds. origin. y + 0.5 , bounds. width - 1 , bounds. height - 1 ) )
105- backgroundGradient. draw ( in: disk, relativeCenterPosition: NSMakePoint ( 0 , 0 ) )
103+ backgroundGradient. draw ( in: disk, relativeCenterPosition: . zero )
106104 strokeColor. setStroke ( )
107105 disk. lineWidth = 0.5
108106 disk. stroke ( )
0 commit comments