Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

useCanvasTap

useCanvasTap<Target>(options): void

Calls onTap on each tap on the canvas: a still, short press of one pointer, a mouse’s left button, a finger or a pen, that went down on the canvas itself. A press on the HUD over the canvas, a drag, even one that comes back, a hold, a pinch and a press under a captured cursor are no tap. It hears a release the map camera captured, and needs no character on the page. Where a tap finds a target, it claims the click that follows, so click-to-walk walks the character nowhere. Roblox’s TouchTapInWorld, Unity’s OnPointerClick through a raycaster and Godot’s input_event each report the thing tapped; this adds the drag and hold limits a map camera’s page needs. Mount it inside <Views>: a room has no canvas.

Type Parameter
Target
Parameter Type
options CanvasTapOptions<Target>

void