fix(ui): 缩小卡片并还原设计稿紧凑排布

This commit is contained in:
2026-11-15 17:14:42 +08:00
parent 3c1a2baace
commit d87aa3ccc5
29 changed files with 609 additions and 272 deletions
+8 -8
View File
@@ -9,15 +9,15 @@ import SwiftUI
if let first = rows.first, let last = rows.last {
precondition(last > 0 && first - last <= 1)
let columns = rows.max()!
let cellWidth = (width - Double(columns - 1) * 6) / Double(columns)
precondition(cellWidth >= 16, "Core text must fit a readable cell instead of being forced into three rows")
let cellWidth = (width - Double(columns - 1) * 3) / Double(columns)
precondition(cellWidth >= 8, "Each real core needs its own visible meter cell")
}
}
}
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 430) == [9, 9])
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 280) == [9, 9])
precondition(CPUCoreGridLayout.rowCounts(count: 32, width: 430) == [16, 16])
precondition(CPUCoreGridLayout.rowCounts(count: 48, width: 430) == [16, 16, 16])
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 430) == [18])
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 280) == [18])
precondition(CPUCoreGridLayout.rowCounts(count: 32, width: 430) == [32])
precondition(CPUCoreGridLayout.rowCounts(count: 48, width: 430) == [24, 24])
for count in [0, 1, 4, 8, 14, 18, 24, 32, 48, 128] {
let kinds = Dictionary(uniqueKeysWithValues: (0..<count).map { ($0, $0 < count / 3 ? CPUCoreTopology.Kind.efficiency : .performance) })
let groups = CPUCoreGrid.groups(count: count, kinds: kinds)
@@ -25,7 +25,7 @@ import SwiftUI
for width in [120.0, 280.0, 380.0, 800.0] {
let widths = CPUCoreGrid.groupWidths(groups: groups, width: width)
precondition(widths.allSatisfy { $0 >= 0 && $0.isFinite })
precondition(widths.reduce(0, +) <= width + 0.001)
precondition(widths.allSatisfy { $0 <= width })
for (group, groupWidth) in zip(groups, widths) {
let rows = CPUCoreGridLayout.rowCounts(count: group.count, width: groupWidth)
precondition(rows.reduce(0, +) == group.count)
@@ -36,6 +36,6 @@ import SwiftUI
precondition(CPUCoreGridLayout.rowCounts(count: 128, width: width).reduce(0, +) == 128)
}
precondition(CPUCoreGrid.groups(count: 3, kinds: [0: .efficiency]).count == 2)
print("PASS: balanced core rows at multiple widths and counts")
print("PASS: compact per-core meters with intact identities and bounded wrapping at multiple widths/counts")
}
}