// Async GPU pick at a rendered (CSS px) position; resolves with the element under the point or null (always null when headless — the sync, node-only cy.nodeAt() computes headless)
cy.pick(x: number, y: number): Promise<Collection<NodeData, EdgeData> | null>Async GPU pick at a rendered (CSS px) position; resolves with the element under the point or null (always null when headless — the sync, node-only cy.nodeAt() computes headless).
Exact: a hit is a point on the drawn element. The pointer gestures additionally apply hit halos (8 rendered px around edges for a mouse, 24 for touch; 2/8 around nodes), so a press can land where this method answers null; the halo belongs to the gesture, not the API.
What wins when elements overlap, as contract: a non-parent node, then an edge, then a compound parent — the reverse of the drawing order in (parents, edges, leaves), so the answer is always the topmost thing drawn at that point. Nesting depth does not change it: a parent inside another parent still draws under every edge, and among parents the deepest wins. Drawing order is structural; there are no z-index or z-compound-depth properties.
| Name | Description |
|---|---|
x: number | rendered (CSS px) x, relative to the container |
y: number | rendered (CSS px) y |
Promise<Collection<NodeData, EdgeData> | null>the element under the point, or null
Example
// Exact GPU picking returns null on a headless core.console.log(await cy.pick(100, 100)); // null