Skip to main content

Module new_pin

Module new_pin 

Source
Expand description

The free-slot markers: where a pin can be added to a block.

Every free pin slot on a block is offered as a small blue dot one grid cell outside the block edge — where the pin’s connection point will land. The dot nearest the cursor animates into a blue ring that grows out to PORT_RADIUS.

Three tools offer them: a selected block offers its own (the “(+)”), the add-pin tool offers every block’s in scope, and the route tool offers the nearest block’s so a route can end on a pin that does not exist yet. Which blocks offer, where a marker sits, which one a press lands on and how one is drawn are decided here, once.

Structs§

SlotMarker
One free slot’s marker: the block a pin would be added to, the slot, and the world point the new pin’s connection will sit at.

Constants§

NEW_PIN_ACTIVATION_RANGE 🔒
How near the cursor must be for a marker’s resting dot to appear.
NEW_PIN_ANIM_TIME 🔒
Grow time for a handle’s activation transition.
NEW_PIN_GROW_RANGE 🔒
How near the cursor must be for a marker to grow into the full control. The resize tool activates on the resting-dot range; the route tool grows the control only this close so the dot reads as a target before it arms.
NEW_PIN_INACTIVE_SCALE 🔒
Resting dot radius as a fraction of PORT_RADIUS (a small, unobtrusive marker).

Functions§

active_marker 🔒
The marker nearest pos within NEW_PIN_ACTIVATION_RANGE, if any. At most one is ever active, so the markers never fight over the cursor.
add_pin 🔒
Add the pin marker offers and open its name for editing. None when the block declines it, as a block locked since the marker was drawn does.
anim_key 🔒
The animation key for one marker, keyed by block, side and slot so each marker animates independently. tag keeps one tool’s animation apart from another’s.
clearances 🔒
What each affordance around a free slot’s marker leaves it: how big the marker’s disc may grow before it touches that neighbour’s own.
draw_marker 🔒
One marker t of the way through growing: the resting dot fades out as the ring and its + grow in, so it reads as the dot expanding into the ring.
draw_markers 🔒
Draw markers as buttons: the one nearest the hover grows its ring, and the one a press holds down is drawn inverted — a filled disk with a light + — and locks out the hover.
draw_plus 🔒
A + glyph centered at center, sized to the marker radius.
draw_route_markers 🔒
Draw the route tool’s markers and return the one armed — grown to the full control — if any. A marker’s resting dot appears once the pointer is within NEW_PIN_ACTIVATION_RANGE; the nearest grows into the ring once the pointer is within NEW_PIN_GROW_RANGE.
marker_at
The marker a press at pos lands on: the active one, within the widest grab its neighbours leave it — wider than the ring draws at, like every other target on the canvas.
markers_in_scope
The markers every block in the current scope offers.
markers_on
Every free slot’s marker on block, whether or not the block offers them.
nearest_block_markers 🔒
The block whose markers the route tool shows with the pointer at pos: the one owning the nearest marker in range, so the cursor is never crowded by several blocks’ markers.
new_pin_grab 🔒
How near the pointer must come to a free slot’s marker for a press to place a pin there.
offered_markers
The markers blocks offer. A block offers none when nothing may be added to it — a locked interface and a read-only session both mean that.