Expand description
Structs§
- Shown
Text - A text box’s text as it is drawn: wrapped at its box’s width and elided
past
TEXT_BOX_MAX_ROWS.
Enums§
- BoxWidth
- How wide a text box is.
Constants§
- BOX_
ROUNDING 🔒 - Corner rounding of the annotation’s boundary, matching
draw_box_outline. - ELLIPSIS 🔒
- TEXT_
BOX_ MAX_ COLUMNS - The widest a text box’s text runs before it wraps, in columns of its font.
- TEXT_
BOX_ MAX_ ROWS - The most rows a text box shows. The rows past it are elided from the drawing; the document keeps them.
- TEXT_
INSET 🔒 - Horizontal/vertical inset of the text from its anchor. The anchor dot sits at the top-left corner; the text starts just inside it so the two don’t overlap.
Functions§
- box_
rect - The text box’s on-canvas rect from a given
anchor. Prefers the cachedsize(measured from a real galley when the text was last edited) and only falls back to thetext_bboxestimate when no measurement exists yet (a freshly created box, or one saved before extents were).anchoris passed in rather than read from the box so callers can shift it during a drag. - column_
cap 🔒 TEXT_BOX_MAX_COLUMNScolumns of the title font.- draw_
anchor - Draw the solid anchor dot shown while a text box is moved. The
Renderertrait exposescircle(notcircle_filled); aNONEstroke makes it a filled dot. - draw_
boundary - Draw the soft card framing a box’s text in
rect: a faint fill plus a thin neutral outline. Drawn before the text so the fill sits behind it. - draw_
text - Draw the annotation’s top-left-aligned text at
anchoras a boxwidthwide shows it, matching the in-place editor’s wrap. - elided 🔒
text, laid out inrows, cut to the firstTEXT_BOX_MAX_ROWSof them. The last row kept ends in an ellipsis, losing the glyphs that would leave it noroomfor one. ARowholds one glyph per character, less the newline that ends it.- measure_
box_ size - Measure
textas a boxwidthwide shows it and return the box extent in whole grid cells — the shown text’s laid-out size plus the inset padding, rounded up so the box always encloses the text. A box with a width of its own keeps it, and only its height follows the text. - text_
bbox 🔒 - Estimate a text block’s on-canvas bounding box from its top-left
anchor.gui_recthas no painter to lay out a galley, so we approximate from the title font’s size. The estimate stands only until the box is first measured, so a slightly padded one is good enough. - text_
origin - Where a box anchored at
anchordraws its text’s top-left corner. - widest_
cells 🔒