Moves the cursor over target, showing it first if hidden. While
recording the move is a glide whose duration scales with distance
(see pz_stage()); pass duration to override it. Without a
recording the cursor jumps.
Usage
pz_cursor_move(
ctx,
target,
...,
duration = NULL,
icon = NULL,
offset = c(0, 0)
)Arguments
- ctx
A paparazzi context.
- target
A CSS selector string, a
pz_loc()spec, or a list of specs. The cursor centers on the match.- ...
Checked empty; reserved for future use.
- duration
Glide duration in seconds;
NULLcomputes one from the distance and thecursor_speedstaging setting.- icon
CSS cursor keyword to show for this call.
NULL(the default) infers the icon at the actual landing point: the first computedcursorother thanautoon the element under the point or an ancestor. Every CSS cursor keyword is supported: for example,default,pointer,text,crosshair,wait,zoom-in, and the resize keywords.nonehides the artwork without changing the overlay's position; an explicitautoshows the default arrow. A bareurl()usesdefault; aurl()with a supported keyword fallback uses that keyword. Custom URL images are not drawn. An explicit icon lasts through this call's landing but does not override the next call's automatic inference. The selected icon stays on the cursor until the next destination; the first off-frame entrance starts withdefaultunless overridden. While recording, an automatic move keeps the icon already visible until it enters the destination and switches there; an expliciticonapplies from the start of the glide and stays through its landing and any press. The artwork tracks CSS zoom and the device pixel ratio internally, and a navigation re-injects the overlay with its last icon.- offset
Landing offset in viewport CSS pixels,
c(x, y)with positive x to the right and positive y downward. A single number is recycled to both axes; the defaultc(0, 0)adds no offset. It applies only to this call and only to the drawn overlay, not to page pointer events. The cursor may land outside the viewport without clamping.
Examples
if (FALSE) { # paparazzi:::examples_run("av")
page <- pz_open(pz_example("tasks"))
path <- file.path(tempdir(), "tour.mp4")
# While recording, the cursor glides between elements
page |>
pz_record(path, {
page |>
pz_cursor_show(".filters", from = "left") |>
pz_cursor_move("#toggle-help", duration = 1) |>
pz_cursor_move("#add-task", icon = "crosshair")
})
pz_close(page)
}
