(
baseYScale: LinearScale,
plotClipRect: Readonly<{ top: number; bottom: number }>,
barSeriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>,
progress01: number
)
| 1433 | }; |
| 1434 | |
| 1435 | const createAnimatedBarYScale = ( |
| 1436 | baseYScale: LinearScale, |
| 1437 | plotClipRect: Readonly<{ top: number; bottom: number }>, |
| 1438 | barSeriesConfigs: ReadonlyArray<ResolvedBarSeriesConfig>, |
| 1439 | progress01: number |
| 1440 | ): LinearScale => { |
| 1441 | const p = clamp01(progress01); |
| 1442 | if (p >= 1) return baseYScale; |
| 1443 | |
| 1444 | const baselineDomain = computeBaselineForBarsFromAxis(barSeriesConfigs, baseYScale, plotClipRect); |
| 1445 | const baselineClip = baseYScale.scale(baselineDomain); |
| 1446 | |
| 1447 | const wrapper: LinearScale = { |
| 1448 | domain(min: number, max: number) { |
| 1449 | baseYScale.domain(min, max); |
| 1450 | return wrapper; |
| 1451 | }, |
| 1452 | range(min: number, max: number) { |
| 1453 | baseYScale.range(min, max); |
| 1454 | return wrapper; |
| 1455 | }, |
| 1456 | scale(value: number) { |
| 1457 | const v = baseYScale.scale(value); |
| 1458 | if (!Number.isFinite(v) || !Number.isFinite(baselineClip)) return v; |
| 1459 | return baselineClip + (v - baselineClip) * p; |
| 1460 | }, |
| 1461 | invert(pixel: number) { |
| 1462 | return baseYScale.invert(pixel); |
| 1463 | }, |
| 1464 | }; |
| 1465 | |
| 1466 | return wrapper; |
| 1467 | }; |
| 1468 | |
| 1469 | export function createRenderCoordinator( |
| 1470 | gpuContext: GPUContextLike, |
no test coverage detected