feat(chart): emit zoom completion payload

This commit is contained in:
李启源
2026-07-21 12:09:00 +08:00
parent e5ce7375cb
commit 32e8cf5856
14 changed files with 461 additions and 21 deletions

View File

@@ -269,7 +269,9 @@ function chooseBestPlacement(
// Try to find a placement that fits completely within bounds
for (const placement of placements) {
if (isPlacementWithinBounds(anchorX, anchorY, width, height, placement, plotWidth, plotHeight)) {
if (
isPlacementWithinBounds(anchorX, anchorY, width, height, placement, plotWidth, plotHeight)
) {
return placement
}
}
@@ -423,8 +425,8 @@ export function layoutAnnotations(
// Choose best placement only if no manual offset exists
const hasManualOffset =
Number.isFinite(annotation.labelOffsetX) && annotation.labelOffsetX !== 0 ||
Number.isFinite(annotation.labelOffsetY) && annotation.labelOffsetY !== 0
(Number.isFinite(annotation.labelOffsetX) && annotation.labelOffsetX !== 0) ||
(Number.isFinite(annotation.labelOffsetY) && annotation.labelOffsetY !== 0)
const { width, height } = annotationBoxSize(lines, trackWidth, localHeight)
const placement: AnnotationPlacement = hasManualOffset