Expand description
Bounding-box estimators for hit-testing pin/port labels and stubs. These
mirror the geometry the drawing primitives use, but return the rect rather
than painting — driving click/drag/marquee targets in widget. They measure
text through whichever Renderer backend the caller holds, so a hit test
is exercisable without an egui context.
Structs§
- PinExtent
- Bounding box of a whole pin as drawn — its stub plus the name and tag labels
— at the given
side/offset. Tools frame selected pins with this so the idle selection rectangle and the drag preview enclose the same parts and the frame doesn’t change shape when a drag begins. - TagSlot
- Shared tag-rect computation used by both block pins and ports.
left/rightare the shape’s edge x-coordinates;line_ythe stub’s y.
Functions§
- block_
pin_ 🔒label_ anchor - World anchor (and horizontal alignment) of a block pin’s labels, matching
pin_text_location. - estimate_
bbox_ for_ pin_ name pin_name_rect_atfor a block pin given itsside/offset.- estimate_
bbox_ for_ pin_ stub - Hit region for a pin/port stub (the red line): the stub segment, widened to
+/-
GRID_SIZE / 3vertically so it presents an easy click target.left/rightare the shape’s edge x-coordinates;line_ythe stub’s y. - estimate_
bbox_ for_ pin_ type pin_type_rect_atfor a block pin given itsside/offset.- pin_
name_ rect_ at - Rect of a pin’s name line at world anchor
pos/h_align, positioned exactly asdraw_pin_labels(centered on the stub). An empty name is sized to the “Add Name” placeholder so the slot stays a click/placeholder target while the shape is selected. - pin_
type_ rect_ at - Rect of a pin’s type line — the sibling of
pin_name_rect_at, measured in the smaller subtitle font and placed just below the name.