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

Function isPointInBar

src/interaction/findNearestPoint.ts:31–40  ·  view source on GitHub ↗
(x: number, y: number, barBounds: BarBounds)

Source from the content-addressed store, hash-verified

29export type BarBounds = { left: number; right: number; top: number; bottom: number };
30
31export function isPointInBar(x: number, y: number, barBounds: BarBounds): boolean {
32 // Inclusive bounds.
33 // Note: stacked bar segments can share edges; tie-breaking is handled by the caller.
34 return (
35 x >= barBounds.left &&
36 x <= barBounds.right &&
37 y >= barBounds.top &&
38 y <= barBounds.bottom
39 );
40}
41
42const clamp01 = (v: number): number => Math.min(1, Math.max(0, v));
43

Callers 1

findNearestPointFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected