Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CurveMarker

Hierarchy

Index

Constructors

constructor

  • new CurveMarker(container: SVGGElement, overlayContainer: HTMLDivElement, settings: Settings): CurveMarker
  • Creates a new marker.

    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 CurveMarker

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 selectorCurve

selectorCurve: SVGPathElement

Invisible wider curve to make selection easier/possible.

Protected strokeColor

strokeColor: string = "transparent"

Line color.

Protected strokeDasharray

strokeDasharray: string = ""

Line dash array.

Protected strokePanel

strokePanel: ColorPickerPanel

Color picker panel for line color.

Protected strokeStylePanel

strokeStylePanel: LineStylePanel

Line dash array toolbox panel.

Protected strokeWidth

strokeWidth: number = 0

Line width.

Protected strokeWidthPanel

strokeWidthPanel: LineWidthPanel

Line width toolbox panel.

Protected visibleCurve

visibleCurve: SVGPathElement

Visible marker curve.

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 = Icon

SVG icon markup displayed on toolbar buttons.

Static title

title: string = "Curve marker"

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

Static typeName

typeName: string = "CurveMarker"

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

Protected addMarkerVisualToContainer

  • addMarkerVisualToContainer(element: SVGElement): void

Protected adjustVisual

  • adjustVisual(): void

Protected colorChanged

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

    Parameters

    • color: string

    Returns void

Protected createGrip

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

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

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

Protected resize

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 setStrokeColor

  • setStrokeColor(color: string): void
  • Sets line color.

    Parameters

    • color: string

      new color.

    Returns void

Protected setStrokeDasharray

  • setStrokeDasharray(dashes: string): void
  • Sets line dash array.

    Parameters

    • dashes: string

      new dash array.

    Returns void

Protected setStrokeWidth

  • setStrokeWidth(width: number): void
  • Sets line width.

    Parameters

    • width: number

      new width.

    Returns void

Protected setupControlBox

  • setupControlBox(): void

Generated using TypeDoc