// Find the topmost node at a rendered position, measured in CSS pixels from the container's top-left corner
cy.nodeAt(x: number, y: number): Collection<NodeData, EdgeData, NodeData> | nullFind the topmost node at a rendered position, measured in CSS pixels from the container's top-left corner. Returns null when no node is hit. Use pick() to test both nodes and edges asynchronously.
Node visibility and level of detail affect the result. In a headless core, the calculation uses the viewport and default rendering thresholds at a device-pixel ratio of 1.
| Name | Description |
|---|---|
x: number | rendered (CSS px) x, relative to the container |
y: number | rendered (CSS px) y |
Collection<NodeData, EdgeData, NodeData> | nullthe node under the point, or null (background, an edge only, or a destroyed instance)
Example
cy.zoom(1); cy.pan({ x: 0, y: 0 });console.log(cy.nodeAt(0, 0)?.id()); // 'a'Also spelled cy.pickNode.
Core#pick for edges and the full draw-order answer