mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
fix: moved battery widget and popup view from dirtyRect to the frame
This commit is contained in:
@@ -130,7 +130,7 @@ public class BatteryWidget: WidgetWrapper {
|
||||
|
||||
let batteryFrame = NSBezierPath(roundedRect: NSRect(
|
||||
x: x + borderWidth + offset,
|
||||
y: ((dirtyRect.size.height - batterySize.height)/2) + offset,
|
||||
y: ((self.frame.size.height - batterySize.height)/2) + offset,
|
||||
width: batterySize.width - borderWidth,
|
||||
height: batterySize.height - borderWidth
|
||||
), xRadius: 2, yRadius: 2)
|
||||
|
||||
@@ -374,10 +374,10 @@ internal class BatteryView: NSView {
|
||||
|
||||
guard let ctx = NSGraphicsContext.current?.cgContext else { return }
|
||||
|
||||
let w: CGFloat = min(dirtyRect.width, 120)
|
||||
let h: CGFloat = min(dirtyRect.height, 50)
|
||||
let x: CGFloat = (dirtyRect.width - w)/2
|
||||
let y: CGFloat = (dirtyRect.size.height - h) / 2
|
||||
let w: CGFloat = min(self.frame.width, 120)
|
||||
let h: CGFloat = min(self.frame.height, 50)
|
||||
let x: CGFloat = (self.frame.width - w)/2
|
||||
let y: CGFloat = (self.frame.size.height - h) / 2
|
||||
let batteryFrame = NSBezierPath(roundedRect: NSRect(x: x+1, y: y+1, width: w-8, height: h-2), xRadius: 3, yRadius: 3)
|
||||
|
||||
NSColor.textColor.set()
|
||||
|
||||
Reference in New Issue
Block a user