Skip to content

Function: cellFromPointer() ​

ts
function cellFromPointer(
   layout, 
   event, 
   options?
): Cell | undefined;

The cell under a pointer event, for handlers on the element showing the layout (a <TileLayout>, an <svg> or a canvas). Unlike handlers on each tile, it can see the gaps: with tolerance, a pointer in the grout picks the nearest tile. Pass element when the handler is on some other element.

Parameters ​

ParameterType
layoutLayout
eventPointerLike
options?HitOptions & object

Returns ​

Cell | undefined

Hat tiling and isohedral tilings after Craig S. Kaplan's hatviz and Tactile (BSD 3-Clause).