Find the topmost node drawn under a point. The geometry is recorded by the
same walk that renders the scene, so offsets, caps and rotation are where they
are drawn; grobs are tested in reverse paint order against that geometry and
their viewport's clip, so the result is clip- and overlap-exact. A filled
shape is matched by its fill rule, a marker by its disc, text by its (rotated)
box, and lines and segments by a band of half their stroke width (at least
2 px). grid ships no equivalent: grid.locator() waits for one interactive
click and returns coordinates rather than a node.
Usage
hit_test(scene, x, y, units = c("npc", "px"))Arguments
- scene
A
vl_scene()(or anything with anas_vellum_scene()method).- x, y
Query point, in
units:"npc"(default; the page,0..1with y up) or"px"(device pixels, top-left origin, y down).- units
"npc"or"px".
