fix(charts): 修复浮窗层级并平滑切频与曲线移出

This commit is contained in:
2026-11-03 12:07:01 +08:00
parent 36b8e32af3
commit 7ef92d9c21
17 changed files with 271 additions and 59 deletions
+13
View File
@@ -30,5 +30,18 @@ struct ResourceCard<Content: View>: View {
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.modifier(PanelCardBackground(radius: 10))
.overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(.primary.opacity(0.14)))
.overlayPreferenceValue(ChartTooltipPreference.self) { tooltip in
GeometryReader { proxy in
if let tooltip {
let plot = proxy[tooltip.plot]
ChartTooltipLayer(point: CGPoint(x: plot.minX + tooltip.point.x, y: plot.minY + tooltip.point.y)) {
tooltip.content.fixedSize(horizontal: false, vertical: true)
}
.frame(width: proxy.size.width, height: proxy.size.height)
}
}
.allowsHitTesting(false)
.accessibilityHidden(true)
}
}
}