Skip to content

Commit

Permalink
fix: moved battery widget and popup view from dirtyRect to the frame
Browse files Browse the repository at this point in the history
  • Loading branch information
exelban committed Sep 30, 2023
1 parent 30f799d commit 80b3914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Kit/Widgets/Battery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions Modules/Battery/popup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 80b3914

Please sign in to comment.