Skip to main content

hitTestHandle

The handle a press at at lands on: the nearest within tolerancePx. At equal distance a vertex beats a radius handle, which beats a midpoint, and the later handle (drawn on top) beats an earlier one. Both map adapters use this, so a press means the same thing on either.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { hitTestHandle } from "@mapcairn/core";

function hitTestHandle(handles: readonly ProjectedHandle[], at: PixelPoint, tolerancePx: number): ProjectedHandle | null;

Parameters​

  • handles (readonly ProjectedHandle[])
  • at (PixelPoint)
  • tolerancePx (number)

Returns​

ProjectedHandle | null

See also​

Source: packages/core/src/draw/hit.ts:50