/** * 2D coordinate in CSS pixels. Matches the shape used by floating-ui's * `Coords` — duplicated here so `slider-utils` has no hidden dependency on * floating-ui types. */ export interface Coords { x: number; y: number; } /** * Returns the midpoint of `element`'s client rect. Used by the slider thumb * collision logic to compute per-thumb hit centers. */ export function getMidpoint(element: HTMLElement): Coords { const rect = element.getBoundingClientRect(); return { x: (rect.left + rect.right) / 2, y: (rect.top + rect.bottom) / 2, }; }