refactor(ui): 统一胶囊页签并将面板收窄至640点

This commit is contained in:
2026-11-08 15:06:27 +08:00
parent 48f7ac73c0
commit 521319ef93
18 changed files with 223 additions and 26 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ import CoreGraphics
@main struct PanelLayoutChecks {
static func main() {
precondition(PanelLayout.contentSize(visible: CGRect(x: 0, y: 0, width: 1512, height: 900)).width == 640)
for visible in [CGRect(x: 0, y: 67, width: 1512, height: 882), CGRect(x: -1440, y: -200, width: 1440, height: 800), CGRect(x: 0, y: 24, width: 800, height: 600)] {
let content = PanelLayout.contentSize(visible: visible, chrome: CGSize(width: 4, height: 12))
precondition(content.width + 4 <= visible.width - 32 && content.height + 12 <= visible.height - 32)
@@ -13,7 +14,7 @@ import CoreGraphics
precondition(visible.insetBy(dx: 16, dy: 16).contains(centered))
}
}
for width: CGFloat in [640, 679, 680, 899, 900, 960] {
for width: CGFloat in [480, 559, 560, 600, 640, 960] {
let size = CGSize(width: width, height: 820)
let columns = PanelLayout.columns(width: width)
let cardWidth = PanelLayout.cardWidth(size: size)
@@ -28,7 +29,7 @@ import CoreGraphics
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), rows: rows))
}
precondition(PanelLayout.rowHeights(columns: 2, coreRows: 2, fanCount: 0) == [220, 204, 260])
precondition(PanelLayout.columns(width: 960) == 2 && PanelLayout.columns(width: 679) == 1)
precondition(PanelLayout.columns(width: 960) == 2 && PanelLayout.columns(width: 559) == 1 && PanelLayout.columns(width: 640) == 2)
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: 960, height: 800), rows: [220, 204, 260]))
let input: [ProcessMetrics] = (0..<2000).map { (index: Int) -> ProcessMetrics in
let id = ProcessIdentity(pid: Int32(index + 1), seconds: 1, microseconds: 0)