perf(ui): 移除监控动效并精简原生图表绘制
This commit is contained in:
@@ -4,7 +4,6 @@ import SwiftUI
|
||||
struct MetricProgressBar: View {
|
||||
let value: Double
|
||||
let color: Color
|
||||
@Environment(\.metricAnimationsEnabled) private var animates
|
||||
|
||||
private var fraction: Double { value.isFinite ? min(1, max(0, value)) : 0 }
|
||||
|
||||
@@ -16,8 +15,7 @@ struct MetricProgressBar: View {
|
||||
}
|
||||
.frame(width: proxy.size.width, height: proxy.size.height)
|
||||
.clipShape(Capsule())
|
||||
.animation(animates ? .easeInOut(duration: MetricMotion.duration) : nil, value: fraction)
|
||||
.transaction { if !animates { $0.disablesAnimations = true } }
|
||||
.transaction { $0.animation = nil; $0.disablesAnimations = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user