Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LinearMarkerBase

LinearMarkerBase is a base class for all line-type markers (Line, Arrow, Measurement Tool, etc.).

Hierarchy

Index

Constructors

constructor

  • Creates a LineMarkerBase object.

    Parameters

    • container: SVGGElement

      SVG container to hold marker's visual.

    • overlayContainer: HTMLDivElement

      overlay HTML container to hold additional overlay elements while editing.

    • settings: Settings

      settings object containing default markers settings.

    Returns LinearMarkerBase

Properties

Protected _container

_container: SVGGElement

Protected _isSelected

_isSelected: boolean = false

Is this marker selected?

since

2.16.0

Protected _overlayContainer

_overlayContainer: HTMLDivElement

Protected _state

_state: MarkerState = "new"

Protected activeGrip

activeGrip: ResizeGrip

Active manipulation grip.

Protected controlBox

controlBox: SVGGElement

Container for control elements.

Protected defaultLength

defaultLength: number = 50

Default line length when marker is created with a simple click (without dragging).

Protected globalSettings

globalSettings: Settings

Protected grip1

grip1: ResizeGrip

First manipulation grip

Protected grip2

grip2: ResizeGrip

Second manipulation grip.

Protected manipulationStartX

manipulationStartX: number = 0

Pointer coordinates at the satart of move or resize.

Protected manipulationStartY

manipulationStartY: number = 0

Optional notes

notes: string

Additional information about the marker

Optional onColorChanged

onColorChanged: (color: string) => void

Method to call when foreground color changes.

Type declaration

    • (color: string): void
    • Parameters

      • color: string

      Returns void

Optional onFillColorChanged

onFillColorChanged: (color: string) => void

Method to call when background/fill color changes.

Type declaration

    • (color: string): void
    • Parameters

      • color: string

      Returns void

onMarkerCreated

onMarkerCreated: (marker: MarkerBase) => void

Method called when marker creation is finished.

Type declaration

Protected visual

visual: SVGGraphicsElement

Marker's main visual.

Protected x1

x1: number = 0

x coordinate of the first end-point

Protected x2

x2: number = 0

x coordinate of the second end-point

Protected y1

y1: number = 0

y coordinate of the first end-point

Protected y2

y2: number = 0

y coordinate of the second end-point

Static icon

icon: string

SVG icon markup displayed on toolbar buttons.

Static title

title: string

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

Static typeName

typeName: string = "MarkerBase"

String type name of the marker type.

Used when adding MarkerArea.availableMarkerTypes via a string and to save and restore state.

Accessors

container

  • get container(): SVGGElement
  • SVG container object holding the marker's visual.

    Returns SVGGElement

isSelected

  • get isSelected(): boolean
  • Returns true if the marker is currently selected

    since

    2.16.0

    Returns boolean

overlayContainer

  • get overlayContainer(): HTMLDivElement
  • HTML container that can be used to render overlay objects while the marker is active.

    For example, this is used for the text editing layer while editing text in the {@see TextMarker}.

    Returns HTMLDivElement

state

  • Current marker state.

    Both MarkerArea and the marker itself can react differently to different events based on what state the marker is in.

    Returns MarkerState

toolboxPanels

typeName

  • get typeName(): string
  • Instance property returning marker's type name.

    since

    2.16.0

    Returns string

Methods

Protected addControlGrips

  • addControlGrips(): void
  • Adds control grips to control box.

    Returns void

Protected addMarkerVisualToContainer

  • addMarkerVisualToContainer(element: SVGElement): void

Protected adjustVisual

  • adjustVisual(): void
  • When implemented adjusts marker visual after manipulation when needed.

    Returns void

Protected colorChanged

  • colorChanged(color: string): void
  • Called by a marker when its foreground color changes.

    Parameters

    • color: string

    Returns void

Protected createGrip

  • Creates manipulation grip.

    Returns ResizeGrip

    • manipulation grip.

dblClick

  • dblClick(point: IPoint, target?: EventTarget): void
  • Handles pointer (mouse, touch, stylus, etc.) double click event.

    Parameters

    • point: IPoint

      event coordinates.

    • Optional target: EventTarget

      direct event target element.

    Returns void

deselect

  • deselect(): void

dispose

  • dispose(): void

Protected fillColorChanged

  • fillColorChanged(color: string): void
  • Called by a marker when its background/fill color changes.

    Parameters

    • color: string

    Returns void

getState

manipulate

  • manipulate(point: IPoint): void
  • Handles marker manipulation (move, resize, rotate, etc.).

    Parameters

    • point: IPoint

      event coordinates.

    Returns void

ownsTarget

  • ownsTarget(el: EventTarget): boolean
  • Returns true if passed SVG element belongs to the marker. False otherwise.

    Parameters

    • el: EventTarget

      target element.

    Returns boolean

pointerDown

  • pointerDown(point: IPoint, target?: EventTarget): void
  • Handles pointer (mouse, touch, stylus, etc.) down event.

    Parameters

    • point: IPoint

      event coordinates.

    • Optional target: EventTarget

      direct event target element.

    Returns void

pointerUp

  • pointerUp(point: IPoint): void
  • Handles pointer (mouse, touch, stylus, etc.) up event.

    Parameters

    • point: IPoint

      event coordinates.

    Returns void

Protected positionGrip

  • positionGrip(grip: SVGGraphicsElement, x: number, y: number): void
  • Positions manipulation grip.

    Parameters

    • grip: SVGGraphicsElement

      grip to position

    • x: number

      new X coordinate

    • y: number

      new Y coordinate

    Returns void

Protected positionGrips

  • positionGrips(): void
  • Updates manipulation grip layout.

    Returns void

Protected resize

  • Resizes the line marker.

    Parameters

    • point: IPoint

      current manipulation coordinates.

    Returns void

restoreState

scale

  • scale(scaleX: number, scaleY: number): void
  • Scales marker. Used after the image resize.

    Parameters

    • scaleX: number

      horizontal scale

    • scaleY: number

      vertical scale

    Returns void

select

  • select(): void

Protected setupControlBox

  • setupControlBox(): void
  • Creates control box for manipulation controls.

    Returns void

Generated using TypeDoc