iink-ts - v5.0.0
    Preparing search index...

    Class TypesetUtil<T>Abstract

    class StickyNoteUtil extends SymbolUtil<TStickyNote> {
    readonly type = "sticky-note"
    create(partial) { ... }
    getGeometry(s) { ... }
    translate(s, { matrix }) { ... }
    rotate(s, { matrix }) { ... }
    resize(s, { matrix }) { ... }
    getSVGElement(s) { ... }
    }
    symbolRegistry.register(new StickyNoteUtil())

    Type Parameters

    Hierarchy (View Summary)

    Index
    • Moves, turns or scales this symbol by composing the matrix onto the one it already carries.

      One implementation for every type, where there used to be one per type per operation. A symbol's coordinates are not touched: the matrix is the whole of what a transform changes, so there is no per-type geometry to update and nothing derived left to refresh.

      Override only for a type whose transform is not affine — DecoratorUtil overrides it to a no-op because a decorator follows its targets rather than moving on its own.

      Parameters

      Returns void

    • The glyphs this symbol draws, in the order they go into the group.

      The only thing text and math do differently: text lays its characters out as tspans on one baseline, math positions super- and subscripts itself. Everything around it — the group, its attributes, the decorators and the order they are layered in — is shared below.

      Parameters

      • symbol: T

      Returns SVGElement[]

    • Parameters

      • _symbol: T

      Returns boolean

    • Parameters

      • _symbol: T

      Returns boolean

    • Parameters

      • _symbol: T

      Returns boolean

    • Parameters

      • _symbol: T

      Returns boolean

    • The box the symbol was measured at, as a shape.

      An outline rather than a filled one, and that is the behaviour it had: typesetOverlapsBox asked "a corner inside the query, or a side crossing one of its sides", both about the boundary. A query landing wholly inside a word therefore did not select it, and still does not.

      symbol.bounds is the raw box, always measured unrotated and unscaled — turning and scaling are the matrix's job — so its corners are the shape, and a frame angle would have nothing to carry.

      Parameters

      • symbol: T

      Returns Polygon2d

    • A rendered word carries what a path does not: style: noSelection, so a drag over it moves the symbol instead of selecting its letters as text, and its opacity — which for a path symbol goes on the path, and here has no path to go on.

      Parameters

      • symbol: T

      Returns Record<string, string>

    • Handles for dragging one vertex of this symbol. Empty by default: most symbols resize by their bounding box alone, and only the edge kinds offer per-vertex handles today.

      Parameters

      • _symbol: T

      Returns TResizePoint[]

    • Shared by text and math, which had the same one line each.

      Parameters

      • symbol: T

      Returns TPoint[]

    • The group, the glyphs, then the decorators — highlights underneath, everything else on top.

      That layering is why decorators are appended here rather than by each subclass: a highlight drawn after the text would paint over it, and the two utils had the same ten lines to avoid it.

      Parameters

      • symbol: T

      Returns SVGGraphicsElement

    • Always. A typeset symbol is drawn from glyphs at a font size, and a font size is one number — scaling the axes unequally would ask for glyphs that do not exist.

      Parameters

      • _symbol: T

      Returns boolean

    • points, carried through symbol.transform the same way a transform manager moves the symbol itself — used by getSnapPoints/getResizePoints overrides, which compute in the symbol's raw frame and hand the result through this once, forward, rather than every symbol type mapping its own points individually.

      Forward, and exact: a point maps to a point however the matrix turns or scales, so points are already the symbol's own geometry, and mapping a point through a matrix is always exact, however that matrix turns or scales.

      Parameters

      Returns TPoint[]

    • Whether a query box touches this symbol — the question selection and erasing both ask.

      Answered by the shape getGeometry returns, so a type describes what it is once and inherits this. Every built-in used to write the same one line here. Override it only for a type whose hit test is not a question about its outline.

      Parameters

      Returns boolean

    • Where a typeset symbol offers to snap, before its matrix: the corners of its box lifted onto the baseline, and its centre. Not the box's own corners — a word is read from its baseline, and lining two words up by their descenders would look wrong.

      Parameters

      • symbol: T

      Returns TPoint[]

    • Moves this symbol by a matrix.

      Concrete rather than abstract: every built-in type composes the matrix the same way, through applyTransform, and none of the six overrides this. A custom util only needs its own body if it stores something a matrix cannot express.

      Parameters

      Returns void

    type: string