feat(menubar): 拆分紧凑双页面板并按页采样

This commit is contained in:
2026-11-08 10:42:55 +08:00
parent ac8b4a7e6a
commit 41dcc497b5
36 changed files with 465 additions and 288 deletions
+6 -4
View File
@@ -13,13 +13,13 @@ import CoreGraphics
precondition(visible.insetBy(dx: 16, dy: 16).contains(centered))
}
}
for width: CGFloat in [640, 899, 900, 1159, 1160, 1240] {
for width: CGFloat in [640, 679, 680, 899, 900, 960] {
let size = CGSize(width: width, height: 820)
let columns = PanelLayout.columns(width: width)
let cardWidth = PanelLayout.cardWidth(size: size)
precondition(abs(CGFloat(columns) * cardWidth + CGFloat(columns - 1) * 8 - (width - 20)) < 0.001)
let rows = PanelLayout.rowHeights(columns: columns, coreRows: 3, fanCount: 6)
let requirements: [CGFloat] = [306, 332, 280, 280, 280, 280]
let requirements: [CGFloat] = [246, 204, 256, 204, 260, 260]
for index in requirements.indices {
precondition(rows[index / columns] >= requirements[index])
}
@@ -27,7 +27,9 @@ import CoreGraphics
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 600), rows: rows))
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), rows: rows))
}
precondition(PanelLayout.rowHeights(columns: 2, coreRows: 2, fanCount: 0) == [280, 280, 280])
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.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)
let path: String? = index == 42 ? "/test/needle" : nil
@@ -55,6 +57,6 @@ import CoreGraphics
}
let pidSorted = ProcessTableProjection.rows(input, query: "", sorting: [ProcessSort(key: .pid)], order: [])
precondition(pidSorted.first?.id.pid == 2000)
print("PASS: physical-row heights, column breakpoints, width conservation, resource scrolling, visible-frame bounds/chrome/negative origins, 2000-row CPU/RSS projection, frozen order, path search and empty results")
print("PASS: physical-row heights, column breakpoints, width conservation, resource scrolling, visible-frame bounds/chrome/negative origins, 2000-row CPU/footprint projection, frozen order, path search and empty results")
}
}