feat(menubar): 支持固定居中面板与独立刷新频率及图表浮层

This commit is contained in:
2026-11-03 11:30:37 +08:00
parent 906293b7c1
commit 36b8e32af3
33 changed files with 1403 additions and 118 deletions
+5 -1
View File
@@ -8,13 +8,17 @@ import CoreGraphics
precondition(content.width + 4 <= visible.width - 32 && content.height + 12 <= visible.height - 32)
for frame in [CGRect(x: -500, y: 500, width: 1240, height: 820), CGRect(x: 1400, y: -800, width: 2000, height: 1200)] {
precondition(visible.insetBy(dx: 16, dy: 16).contains(PanelLayout.constrainedFrame(frame, visible: visible)))
let centered = PanelLayout.centeredFrame(frame, visible: visible)
precondition(abs(centered.midX - visible.midX) < 0.001)
precondition(visible.insetBy(dx: 16, dy: 16).contains(centered))
}
}
for size in [CGSize(width: 1240, height: 820), CGSize(width: 1160, height: 810)] {
let square = PanelLayout.resourceRowHeight(size: size)
let wide = PanelLayout.firstRowWideCardWidth(size: size)
precondition(square >= 220 && square <= 230)
precondition(abs(2 * wide + square + 16 - (size.width - 20)) < 0.001)
precondition(abs(PanelLayout.batteryWidth(size: size) / square - 4.0 / 3.0) < 0.001)
precondition(abs(2 * wide + PanelLayout.batteryWidth(size: size) + 16 - (size.width - 20)) < 0.001)
}
let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)