feat(ui): 统一实现卡片背景趋势与大数值布局

This commit is contained in:
2026-11-15 15:40:29 +08:00
parent 397156249b
commit 3c1a2baace
25 changed files with 447 additions and 268 deletions
+5 -4
View File
@@ -25,12 +25,13 @@ nonisolated enum PanelLayout {
}
}
/// Fixed content rows with a 48pt plot. Nil fans reserve a discovery row.
/// Foreground details and the edge-to-edge background trend have separate budgets.
static func cardHeights(coreRows: Int, fanCount: Int?) -> [PanelCard: CGFloat] {
let base = ResourceCardMetrics.minimumHeight
let fanRows = fanCount.map { (max(0, $0) + 1) / 2 } ?? 1
return [.cpu: 152 + CGFloat(max(1, coreRows)) * 26,
.gpu: fanRows == 0 ? 124 : 144 + CGFloat(fanRows) * 20,
.memory: 180, .battery: 170, .storage: 170, .network: 208]
return [.cpu: base + CGFloat(max(0, coreRows - 2)) * 26,
.gpu: base + CGFloat(max(0, fanRows - 1)) * 20,
.memory: base, .battery: base, .storage: base, .network: base]
}
static func rowHeights(columns: Int, heights: [PanelCard: CGFloat]) -> [CGFloat] {