Expand description
Pure position/alignment helpers shared by the drawing primitives and by the
hit-testing in widget. No drawing happens here — each function maps an
element’s geometry to a label anchor (and its Align2).
Constants§
- PIN_
TAG_ 🔒RISE - Vertical gap, in world units, between a pin/port’s stub line and the
baseline-center of the
taglabel drawn above it.
Functions§
- block_
title_ position - block_
type_ position - clamp_
label_ offset - Clamp a block label’s horizontal
offsetso its text of widthtext_widthstays within the block’s horizontal extent, given the label’s horizontal anchor —Align::Centerfor the title,Align::Min(left) for the type,Align::Max(right) for the tag. When the text is wider than the block the label is pinned flush to its anchored edge. - clamped_
block_ title_ position - Like
block_title_position, but clamps the horizontal offset so a title of widthtext_widthstays within the block (pinning flush when wider). Used at draw time so a later resize can’t leave a stale offset drawing outside the block. - clamped_
block_ type_ position - Like
block_type_position, but clamps the horizontal offset so a type label of widthtext_widthstays within the block (pinning flush when wider). Used at draw time so a later resize can’t leave a stale offset drawing outside. - label_
side_ for_ y - The
LabelSidea block label snaps to when its anchor is dragged toy: the top third of the block is Top, the bottom third Bottom, the middle Center. Shared by the live drag preview and the drag-commit so both agree. - pin_
tag_ location - Position and alignment for the
taglabel, which sits above the stub line hugging the shape edge: right-justified on the West side, left-justified on the East side (opposite to hownameis justified).left/rightare the shape’s edge x-coordinates (the inner end of the stub);line_yis the stub’s y. - pin_
text_ location - port_
text_ center - title_
anchor 🔒 - type_
anchor 🔒 - Placement of a block’s type label. Mirrors
block_title_positionbut is left-anchored to the block’s left edge, so the default (offset == 0,side == Top) sits in the upper-left corner with the text baseline on the top edge and the left edge flush with the block’s.