MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / zoomIn

Function zoomIn

src/interaction/createZoomState.ts:247–258  ·  view source on GitHub ↗
(center, factor)

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 3

applyNextRangeFunction · 0.85
clampFunction · 0.70
clamp01Function · 0.70

Tested by

no test coverage detected