UNPKG

victory-native

Version:

A charting library for React Native with a focus on performance and customization.

21 lines (19 loc) 468 B
import type { CartesianChartOrientation } from "../../types"; import { findClosestPoint } from "../../utils/findClosestPoint"; export const getClosestDatumIndex = ({ orientation, categoryPositions, touchX, touchY, }: { orientation: CartesianChartOrientation; categoryPositions: number[]; touchX: number; touchY: number; }) => { "worklet"; return findClosestPoint( categoryPositions, orientation === "horizontal" ? touchY : touchX, ); };