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

    Class ShapeUtil

    Hierarchy (View Summary)

    Index
    • Parameters

      Returns symbol is TShape

      True if symbol is a shape

    • 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

    • Parameters

      • center: TPoint
      • radius: number
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapeCircle

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapeCircle

    • Parameters

      • partial: {
            center?: { x?: number; y?: number };
            creationTime?: number;
            id?: string;
            kind?: Circle;
            modificationDate?: number;
            radius?: number;
            style?: {
                color?: string;
                fill?: string;
                opacity?: number;
                pen?: TPenNib;
                penAngle?: number;
                penSmoothing?: number;
                penSpeed?: number;
                width?: number;
                [key: string]: string | number | undefined;
            };
            transform?: {
                tx?: number;
                ty?: number;
                xx?: number;
                xy?: number;
                yx?: number;
                yy?: number;
            };
            type?: Shape;
        }
        • Optionalcenter?: { x?: number; y?: number }
        • OptionalcreationTime?: number
        • Optionalid?: string
        • Optionalkind?: Circle
        • OptionalmodificationDate?: number
        • Optionalradius?: number
        • Optionalstyle?: {
              color?: string;
              fill?: string;
              opacity?: number;
              pen?: TPenNib;
              penAngle?: number;
              penSmoothing?: number;
              penSpeed?: number;
              width?: number;
              [key: string]: string | number | undefined;
          }
        • Optionaltransform?: { tx?: number; ty?: number; xx?: number; xy?: number; yx?: number; yy?: number }

          Where this symbol sits, relative to the coordinates it stores.

          A transform writes here and nowhere else: the raw coordinates are what the symbol was created with and never move again. That is what lets the renderer apply a change by rewriting one attribute instead of rebuilding the element, and what keeps undo exact — re-applying an inverse matrix restores the value bit for bit, where re-transforming coordinates accumulated rounding.

          • Optionaltx?: number

            translation x

          • Optionalty?: number

            translation y

          • Optionalxx?: number

            scaling x

          • Optionalxy?: number

            shearing y

          • Optionalyx?: number

            shearing x

          • Optionalyy?: number

            scaling y

        • Optionaltype?: Shape

      Returns TShapeCircle

    • Parameters

      • center: TPoint
      • radiusX: number
      • radiusY: number
      • orientation: number
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapeEllipse

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapeEllipse

    • Parameters

      • partial: {
            center?: { x?: number; y?: number };
            creationTime?: number;
            id?: string;
            kind?: Ellipse;
            modificationDate?: number;
            orientation?: number;
            radiusX?: number;
            radiusY?: number;
            style?: {
                color?: string;
                fill?: string;
                opacity?: number;
                pen?: TPenNib;
                penAngle?: number;
                penSmoothing?: number;
                penSpeed?: number;
                width?: number;
                [key: string]: string | number | undefined;
            };
            transform?: {
                tx?: number;
                ty?: number;
                xx?: number;
                xy?: number;
                yx?: number;
                yy?: number;
            };
            type?: Shape;
        }
        • Optionalcenter?: { x?: number; y?: number }
        • OptionalcreationTime?: number
        • Optionalid?: string
        • Optionalkind?: Ellipse
        • OptionalmodificationDate?: number
        • Optionalorientation?: number
        • OptionalradiusX?: number
        • OptionalradiusY?: number
        • Optionalstyle?: {
              color?: string;
              fill?: string;
              opacity?: number;
              pen?: TPenNib;
              penAngle?: number;
              penSmoothing?: number;
              penSpeed?: number;
              width?: number;
              [key: string]: string | number | undefined;
          }
        • Optionaltransform?: { tx?: number; ty?: number; xx?: number; xy?: number; yx?: number; yy?: number }

          Where this symbol sits, relative to the coordinates it stores.

          A transform writes here and nowhere else: the raw coordinates are what the symbol was created with and never move again. That is what lets the renderer apply a change by rewriting one attribute instead of rebuilding the element, and what keeps undo exact — re-applying an inverse matrix restores the value bit for bit, where re-transforming coordinates accumulated rounding.

          • Optionaltx?: number

            translation x

          • Optionalty?: number

            translation y

          • Optionalxx?: number

            scaling x

          • Optionalxy?: number

            shearing y

          • Optionalyx?: number

            shearing x

          • Optionalyy?: number

            scaling y

        • Optionaltype?: Shape

      Returns TShapeEllipse

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapePolygon

    • Parameters

      • points: TPoint[]
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapePolygon

    • Parameters

      • partial: {
            creationTime?: number;
            id?: string;
            kind?: Polygon;
            modificationDate?: number;
            points?: ({ x?: number; y?: number } | undefined)[];
            style?: {
                color?: string;
                fill?: string;
                opacity?: number;
                pen?: TPenNib;
                penAngle?: number;
                penSmoothing?: number;
                penSpeed?: number;
                width?: number;
                [key: string]: string | number | undefined;
            };
            transform?: {
                tx?: number;
                ty?: number;
                xx?: number;
                xy?: number;
                yx?: number;
                yy?: number;
            };
            type?: Shape;
        }
        • OptionalcreationTime?: number
        • Optionalid?: string
        • Optionalkind?: Polygon
        • OptionalmodificationDate?: number
        • Optionalpoints?: ({ x?: number; y?: number } | undefined)[]
        • Optionalstyle?: {
              color?: string;
              fill?: string;
              opacity?: number;
              pen?: TPenNib;
              penAngle?: number;
              penSmoothing?: number;
              penSpeed?: number;
              width?: number;
              [key: string]: string | number | undefined;
          }
        • Optionaltransform?: { tx?: number; ty?: number; xx?: number; xy?: number; yx?: number; yy?: number }

          Where this symbol sits, relative to the coordinates it stores.

          A transform writes here and nowhere else: the raw coordinates are what the symbol was created with and never move again. That is what lets the renderer apply a change by rewriting one attribute instead of rebuilding the element, and what keeps undo exact — re-applying an inverse matrix restores the value bit for bit, where re-transforming coordinates accumulated rounding.

          • Optionaltx?: number

            translation x

          • Optionalty?: number

            translation y

          • Optionalxx?: number

            scaling x

          • Optionalxy?: number

            shearing y

          • Optionalyx?: number

            shearing x

          • Optionalyy?: number

            scaling y

        • Optionaltype?: Shape

      Returns TShapePolygon

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapePolygon

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapePolygon

    • Parameters

      • origin: TPoint
      • target: TPoint
      • Optionalstyle: {
            color?: string;
            fill?: string;
            opacity?: number;
            pen?: TPenNib;
            penAngle?: number;
            penSmoothing?: number;
            penSpeed?: number;
            width?: number;
            [key: string]: string | number | undefined;
        }

      Returns TShapePolygon

    • Parameters

      Returns string

    • Parameters

      Returns string

    • An unregistered kind gets an empty polygon: no vertices, no edges, an empty box at the origin, and so no overlap with anything. Same answer the record fallback gave, said once instead of field by field.

      Parameters

      Returns Geometry2d

    • Which of the three kinds it is, on top of what every symbol's group carries.

      Parameters

      Returns Record<string, string>

    • Stroked and filled, the fill coming from the style — the only family that paints both.

      Parameters

      Returns Record<string, string>

    • The d of the path this symbol draws.

      Separate from PathSymbolUtil.getPathAttributes because it is the one part no default can supply and the one part a new type always has to write: d is the shape as drawn.

      Parameters

      Returns string

    • Parameters

      Returns 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

      Returns TResizePoint[]

    • A shape snaps on its box — corners, mid-sides and centre — whatever its outline looks like.

      None at all for a kind the table does not own: its box is an empty one at the origin, and offering nine snap points there would pull anything nearby to the corner of the page.

      Parameters

      Returns TPoint[]

    • The element that draws this symbol.

      Required rather than optional: a symbol nothing can draw is a symbol the canvas cannot show, and when this was optional a custom util that omitted it registered successfully and then silently rendered nothing. Return undefined only for a state deliberately left undrawn — the decorator does that for a kind it does not own.

      Honoured by the SVG renderer, which InteractiveInkCanvas, InkCanvas and InteractiveInkSSRCanvas all use. InkCanvasDeprecated (INK_V1) ignores it: it draws through CanvasRenderer, which dispatches on isStroke and two fixed renderer tables instead of asking the registry, so a registered custom symbol is invisible there and logs "symbol type unknown". That variant is deprecated and not worth wiring up.

      Parameters

      Returns SVGGraphicsElement

    • Parameters

      Returns string

    • Whether a resize of this symbol must preserve its aspect ratio.

      False by default. IIResizeManager decided this with isText(s) || isMath(s) || (isShape(s) && isCircleShape(s)), which is a question about a symbol asked from outside it — so a custom symbol could never require a locked ratio, however badly a free scale would distort it.

      Parameters

      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

    • 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: Shape = SymbolType.Shape