marker.js 3 Documentation
    Preparing search index...

    Class TextMarker

    Text marker.

    Used to represent a text block as well a base class for other text-based markers.

    Hierarchy (View Summary)

    Index

    Accessors

    • get container(): SVGGElement

      SVG container object holding the marker's visual.

      Returns SVGGElement

    • get strokeColor(): string

      Stroke (outline) color of the marker.

      In a derived class override applyStrokeColor to apply the color to the marker's visual.

      Returns string

    • set strokeColor(color: string): void

      Parameters

      • color: string

      Returns void

    • get strokeDasharray(): string

      Stroke (outline) dash array of the marker.

      In a derived class override applyStrokeDasharray to apply the dash array to the marker's visual.

      Returns string

    • set strokeDasharray(value: string): void

      Parameters

      • value: string

      Returns void

    • get typeName(): string

      Returns marker type name for the object instance.

      Returns string

    Constructors

    Methods

    Properties

    _container: SVGGElement

    SVG container object holding the marker's visual.

    It is created and passed to the constructor by marker editor or viewer when creating the marker.

    _fillColor: string = 'transparent'

    Fill color of the marker.

    _opacity: number = 1

    Opacity of the marker.

    _strokeColor: string = 'transparent'

    Stroke (outline) color of the marker.

    _strokeDasharray: string = ''

    Stroke (outline) dash array of the marker.

    _strokeWidth: number = 0

    Stroke (outline) width of the marker.

    applyDefaultFilter: boolean = true

    When true, the default filter is applied to the marker's visual.

    3.2.0

    DEFAULT_TEXT: string = 'Text'

    Default text for the marker type.

    defaultSize: ISize = ...

    The default marker size when the marker is created with a click (without dragging).

    height: number = 0

    Marker height.

    left: number = 0

    x coordinate of the top-left corner.

    notes?: string

    Additional information about the marker.

    Generally, this isn't used for anything functional. However, in a derived type it could be used for storing arbitrary data with no need to create extra properties and state types.

    onSizeChanged?: (textMarker: TextMarker) => void

    Callback to be called when the text size changes.

    padding: number = 2

    Text padding from the bounding box.

    rotationAngle: number = 0

    Marker's rotation angle.

    stage: MarkerStage = 'normal'

    Marker lifecycle stage.

    Most markers are created immediately after the user clicks on the canvas (normal). However, some markers are only finished creating after additional interactions (creating).

    textBlock: TextBlock = ...

    Text block handling the text rendering.

    textBoundingBox: DOMRect

    Text's bounding box where text should fit and/or be anchored to.

    title: string = 'Text marker'

    Marker type title (display name) used for accessibility and other attributes.

    top: number = 0

    y coordinate of the top-left corner.

    typeName: string = 'TextMarker'

    Marker type name.

    It's important to set this in each derived class. This value is used to identify marker types when restoring marker state and other scenarios.

    width: number = 0

    Marker width.