refactor(menubar): 精简内存卡片并对齐双列底部

This commit is contained in:
2026-11-09 00:05:25 +08:00
parent 28112bcf2e
commit 1afe82b233
15 changed files with 119 additions and 40 deletions
+8 -5
View File
@@ -27,10 +27,11 @@ import CoreGraphics
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 500), heights: compact))
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: width, height: 2400), heights: compact))
}
precondition(PanelLayout.columnHeights(columns: 2, heights: compact) == [612, 564])
precondition(PanelLayout.preferredHeight(width: 640, heights: compact) == 706)
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: 640, height: 706), heights: compact))
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: 640, height: 680), heights: compact))
precondition(PanelLayout.columnHeights(columns: 2, heights: compact) == [564, 564],
"The compact memory card must align ordinary two-column bottoms")
precondition(PanelLayout.preferredHeight(width: 640, heights: compact) == 658)
precondition(!PanelLayout.needsResourceScroll(size: CGSize(width: 640, height: 658), heights: compact))
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: 640, height: 640), heights: compact))
precondition(PanelLayout.needsResourceScroll(size: CGSize(width: 480, height: 800), heights: compact))
precondition(PanelLayout.columns(width: 640) == 2 && PanelLayout.columns(width: 559) == 1)
let tallerCPU = PanelLayout.cardHeights(coreRows: 6, fanCount: 2)
@@ -39,7 +40,9 @@ import CoreGraphics
let moreFans = PanelLayout.cardHeights(coreRows: 2, fanCount: 6)
precondition(moreFans[.gpu]! > compact[.gpu]! && moreFans[.storage] == compact[.storage])
let noFans = PanelLayout.cardHeights(coreRows: 2, fanCount: 0)
precondition(noFans[.gpu] == 124 && PanelLayout.preferredHeight(width: 640, heights: noFans) < 706)
precondition(noFans[.gpu] == 124 && PanelLayout.columnHeights(columns: 2, heights: noFans) == [524, 564])
precondition(PanelLayout.preferredHeight(width: 640, heights: noFans) == 658,
"The right column owns the height when the GPU has no fan section")
precondition(PanelLayout.cardHeights(coreRows: 2, fanCount: nil) == compact,
"Discovery placeholders must reserve the ordinary fan row")
let manyCores = PanelLayout.cardHeights(coreRows: 30, fanCount: 10)