(
baseXDomain: { readonly min: number; readonly max: number },
zoomRange?: ZoomRange | null
)
| 1285 | }; |
| 1286 | |
| 1287 | const computeVisibleXDomain = ( |
| 1288 | baseXDomain: { readonly min: number; readonly max: number }, |
| 1289 | zoomRange?: ZoomRange | null |
| 1290 | ): { readonly min: number; readonly max: number; readonly spanFraction: number } => { |
| 1291 | if (!zoomRange) return { ...baseXDomain, spanFraction: 1 }; |
| 1292 | const span = baseXDomain.max - baseXDomain.min; |
| 1293 | if (!Number.isFinite(span) || span === 0) return { ...baseXDomain, spanFraction: 1 }; |
| 1294 | |
| 1295 | const start = zoomRange.start; |
| 1296 | const end = zoomRange.end; |
| 1297 | const xMin = baseXDomain.min + (start / 100) * span; |
| 1298 | const xMax = baseXDomain.min + (end / 100) * span; |
| 1299 | const normalized = normalizeDomain(xMin, xMax); |
| 1300 | |
| 1301 | const fractionRaw = (end - start) / 100; |
| 1302 | const spanFraction = Number.isFinite(fractionRaw) ? Math.max(0, Math.min(1, fractionRaw)) : 1; |
| 1303 | return { min: normalized.min, max: normalized.max, spanFraction }; |
| 1304 | }; |
| 1305 | |
| 1306 | type IntroPhase = 'pending' | 'running' | 'done'; |
| 1307 |
no test coverage detected