perf(menubar): 减少进程表刷新排序并清理闲置代码
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
import SwiftUI
|
||||
|
||||
/// Clips both layers to the track, including fills narrower than the track height.
|
||||
struct MetricProgressBar: View {
|
||||
let value: Double
|
||||
let color: Color
|
||||
var cornerRadius: CGFloat? = nil
|
||||
|
||||
private var fraction: Double { value.isFinite ? min(1, max(0, value)) : 0 }
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
let shape = RoundedRectangle(cornerRadius: cornerRadius ?? proxy.size.height / 2, style: .continuous)
|
||||
ZStack(alignment: .leading) {
|
||||
shape.fill(color.opacity(0.15))
|
||||
shape.fill(color).frame(width: proxy.size.width * fraction)
|
||||
}
|
||||
.frame(width: proxy.size.width, height: proxy.size.height)
|
||||
.clipShape(shape)
|
||||
.transaction { $0.animation = nil; $0.disablesAnimations = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user