Class AbstractCanvas2DAbstract

Base class for all canvases.

The following methods make up the public interface of the canvas 2D for all painting in mxGraph:

arcTo is an additional method for drawing paths. This is a synthetic method, meaning that it is turned into a sequence of curves by default. Subclasses may add native support for arcs.

All color values of NONE will be converted to null in the state.

Hierarchy (view full)

Constructors

Properties

closeOp: string = 'Z'

Holds the operator for closing curves. Default is 'Z'.

converter: UrlConverter

Holds the to convert image URLs.

curveOp: string = 'C'

Contains the string used for bezier curves. Default is 'C'.

lastX: number = 0

Holds the last x coordinate.

lastY: number = 0

Holds the last y coordinate.

lineOp: string = 'L'

Contains the string used for moving in paths. Default is 'L'.

moveOp: string = 'M'

Contains the string used for moving in paths. Default is 'M'.

path: (string | number)[] = []

Holds the current path as an array.

pointerEvents: boolean = false

Boolean value that specifies if events should be handled. Default is false.

pointerEventsValue: null | string = null
quadOp: string = 'Q'

Contains the string used for quadratic paths. Default is 'Q'.

rotateHtml: boolean = true

Switch for rotation of HTML. Default is false.

state: CanvasState = ...

Holds the current state.

states: CanvasState[] = []

Stack of states.

Methods

  • Adds the given arc to the current path. This is a synthetic operation that is broken down into curves.

    Parameters

    • rx: number
    • ry: number
    • angle: number
    • largeArcFlag: boolean
    • sweepFlag: boolean
    • x: number
    • y: number

    Returns void

  • Closes the current path.

    Parameters

    • Optionalx1: number
    • Optionaly1: number
    • Optionalx2: number
    • Optionaly2: number
    • Optionalx3: number
    • Optionaly3: number

    Returns void

  • Adds a bezier curve to the current path.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number
    • x3: number
    • y3: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • w: number
    • h: number
    • src: string
    • aspect: boolean
    • flipH: boolean
    • flipV: boolean

    Returns void

  • Draws a line to the given coordinates. Uses moveTo with the op argument.

    Parameters

    • x: number
    • y: number

    Returns void

  • Adds a quadratic curve to the current path.

    Parameters

    • x1: number
    • y1: number
    • x2: number
    • y2: number

    Returns void

  • Rotates the current state.

    Parameters

    • theta: number
    • flipH: boolean
    • flipV: boolean
    • cx: number
    • cy: number

    Returns void

  • Sets the current gradient.

    Parameters

    • color1: string
    • color2: string
    • x: number
    • y: number
    • w: number
    • h: number
    • direction: DirectionValue
    • alpha1: number = 1
    • alpha2: number = 1

    Returns void

  • Sets the current shadow alpha.

    Parameters

    • value: number

      Number that represents the new alpha. Possible values are between 1 (opaque) and 0 (transparent).

    Returns void

  • Sets the current shadow color.

    Parameters

    • value: null | string

      Hexadecimal representation of the color or none.

    Returns void

  • Sets the current shadow offset.

    Parameters

    • dx: number

      Number that represents the horizontal offset of the shadow.

    • dy: number

      Number that represents the vertical offset of the shadow.

    Returns void