(center, factor)
| 245 | }; |
| 246 | |
| 247 | const zoomIn: ZoomState['zoomIn'] = (center, factor) => { |
| 248 | if (!Number.isFinite(center) || !Number.isFinite(factor)) return; |
| 249 | if (factor <= 1) return; |
| 250 | |
| 251 | const c = clamp(center, 0, 100); |
| 252 | const span = end - start; |
| 253 | const r = span === 0 ? 0.5 : clamp01((c - start) / span); |
| 254 | const nextSpan = span / factor; |
| 255 | const nextStart = c - r * nextSpan; |
| 256 | const nextEnd = nextStart + nextSpan; |
| 257 | applyNextRange(nextStart, nextEnd, { anchor: { center: c, ratio: r } }); |
| 258 | }; |
| 259 | |
| 260 | const zoomOut: ZoomState['zoomOut'] = (center, factor) => { |
| 261 | if (!Number.isFinite(center) || !Number.isFinite(factor)) return; |
nothing calls this directly
no test coverage detected