MCPcopy Create free account
hub / github.com/ChartGPU/ChartGPU / createCoordinatorZoomStateLike

Function createCoordinatorZoomStateLike

examples/million-points/main.ts:311–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309 };
310
311 const createCoordinatorZoomStateLike = (): ZoomState => {
312 const getRange: ZoomState['getRange'] = () => coordinator?.getZoomRange() ?? { start: 0, end: 100 };
313 const setRange: ZoomState['setRange'] = (start, end) => coordinator?.setZoomRange(start, end);
314 const pan: ZoomState['pan'] = (delta) => {
315 const r = coordinator?.getZoomRange();
316 if (!r || !Number.isFinite(delta)) return;
317 coordinator?.setZoomRange(r.start + delta, r.end + delta);
318 };
319 const zoomIn: ZoomState['zoomIn'] = () => {
320 // Not needed for slider UI; keep as a no-op for interface completeness.
321 };
322 const zoomOut: ZoomState['zoomOut'] = () => {
323 // Not needed for slider UI; keep as a no-op for interface completeness.
324 };
325 const onChange: ZoomState['onChange'] = (cb) => coordinator?.onZoomRangeChange(cb) ?? (() => {});
326 return { getRange, setRange, pan, zoomIn, zoomOut, onChange };
327 };
328
329 const syncSliderUi = (): void => {
330 if (!coordinator) return;

Callers 1

syncSliderUiFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected