@antv/util
Version:
> AntV 底层依赖的工具库,不建议在自己业务中使用。
11 lines (9 loc) • 394 B
text/typescript
import type { Point, PathArray } from '../types';
import { getPropertiesAtPoint } from './get-properties-at-point';
/**
* Checks if a given point is in the stroke of a path.
*/
export function isPointInStroke(pathInput: string | PathArray, point: Point) {
const { distance } = getPropertiesAtPoint(pathInput, point);
return Math.abs(distance) < 0.001; // 0.01 might be more permissive
}