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

Function normalizeRange

src/components/createDataZoomSlider.ts:18–26  ·  view source on GitHub ↗
(range: ZoomRange)

Source from the content-addressed store, hash-verified

16const clamp = (v: number, lo: number, hi: number): number => Math.min(hi, Math.max(lo, v));
17
18const normalizeRange = (range: ZoomRange): ZoomRange => {
19 let { start, end } = range;
20 if (start > end) {
21 const t = start;
22 start = end;
23 end = t;
24 }
25 return { start: clamp(start, 0, 100), end: clamp(end, 0, 100) };
26};
27
28type DragMode = 'left-handle' | 'right-handle' | 'pan-window';
29

Callers 1

applyRangeToDomFunction · 0.85

Calls 1

clampFunction · 0.70

Tested by

no test coverage detected