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

Function zoomIn

src/ChartGPU.ts:702–712  ·  view source on GitHub ↗
(center, factor)

Source from the content-addressed store, hash-verified

700 coordinator?.setZoomRange(start, end);
701 };
702 const zoomIn: ZoomState['zoomIn'] = (center, factor) => {
703 if (!Number.isFinite(center) || !Number.isFinite(factor) || factor <= 1) return;
704 const r = coordinator?.getZoomRange();
705 if (!r) return;
706 const c = clamp(center, 0, 100);
707 const ratio = computeZoomInOutAnchorRatio(r, c);
708 const span = r.end - r.start;
709 const nextSpan = span / factor;
710 const nextStart = c - ratio * nextSpan;
711 coordinator?.setZoomRange(nextStart, nextStart + nextSpan);
712 };
713 const zoomOut: ZoomState['zoomOut'] = (center, factor) => {
714 if (!Number.isFinite(center) || !Number.isFinite(factor) || factor <= 1) return;
715 const r = coordinator?.getZoomRange();

Callers

nothing calls this directly

Calls 4

clampFunction · 0.70
getZoomRangeMethod · 0.65
setZoomRangeMethod · 0.65

Tested by

no test coverage detected