Expand description
The canvas hit-test z-order, encoded once.
Every pointer gesture — hover, click, double-click, drag — asks
Drawing::resolve_at_pos what is under the cursor and reacts to the answer.
Tools keep their reactions (which tool to switch to); none of them re-derives
what was hit, so hover, click and drag can never disagree about it.
Two orders meet here. Across kinds the priority is editorial — labels
beat the bodies they sit on, a port beats a route crossing it — and
Drawing::resolve_at_pos is the only place it is written down.
Within a kind there is no separate hit order at all: hit order is draw
order back to front, so the shape painted last is tested first
(Drawing::hit_candidates, the document’s one chronological order
reversed). Every fine-phase test lives here too, so the priorities and
the tests they order can be read together.
Enums§
- HitTarget
- What sits at a point on the canvas, resolved top-down.
- PinPart
- Which part of a pin was hit. The stub is last so a tag drawn over it (the tag rises only a few pixels above the stub line) stays double-clickable.
Constants§
- LABEL_
HIT_ 🔒PAD - Slack added around a drawn label’s text extent when hit-testing it, so small text is comfortably clickable.