Options
All
  • Public
  • Public/Protected
  • All
Menu

Base class for all canvases. All color values of <mxConstants.NONE> will be converted to null in the state.

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. Subclassers may add native support for arcs.

Note: this type is not abstract in the mxGraph JavaScript code (ES5) but both its name and its usage shows that it should not be instantiated and that it only serves as base class for usage and extension.

Hierarchy

Index

Constructors

Protected constructor

Properties

closeOp

closeOp: string

Holds the operator for closing curves.

default

'Z'

curveOp

curveOp: string

Contains the string used for bezier curves.

default

'C'

lastX

lastX: number

Holds the last x coordinate.

default

0

lastY

lastY: number

Holds the last y coordinate.

default

0

lineOp

lineOp: string

Contains the string used for moving in paths.

default

'L'

moveOp

moveOp: string

Contains the string used for moving in paths.

default

'M'

path

path: string[]

Holds the current path as an array.

pointerEvents

pointerEvents: boolean

Boolean value that specifies if events should be handled.

default

false

quadOp

quadOp: string

Contains the string used for quadratic paths.

default

'Q'

rotateHtml

rotateHtml: boolean

Switch for rotation of HTML.

default

true

state

Holds the current state.

states

states: mxCanvas2DState[]

Stack of states.

Methods

addOp

  • addOp(): void

arcTo

  • arcTo(rx: number, ry: number, angle: number, largeArcFlag: number, sweepFlag: number, x: number, y: number): void
  • 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: number
    • sweepFlag: number
    • x: number
    • y: number

    Returns void

begin

  • begin(): void

close

  • close(): void
  • Closes the current path.

    Note: the mxGraph JS code declares arguments (x1: number, y1: number, x2: number, y2: number, x3: number, y3: number) which are not used in the abstract implementation. The mxXmlCanvas2D JS implementation overrides this method without arguments. Decision is then taken to remove them here.

    Returns void

createState

createUrlConverter

curveTo

  • curveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void
  • Adds a bezier curve to the current path.

    Parameters

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

    Returns void

ellipse

  • ellipse(x: number, y: number, w: number, h: number): void

end

  • end(): void

fill

  • fill(): void

fillAndStroke

  • fillAndStroke(): void

format

  • format(value: string): number

image

  • image(x: number, y: number, w: number, h: number, src: string, aspect: boolean, flipH: boolean, flipV: boolean): void
  • Parameters

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

    Returns void

lineTo

  • lineTo(x: number, y: number): void
  • Draws a line to the given coordinates. Uses moveTo with the op argument.

    Parameters

    • x: number
    • y: number

    Returns void

moveTo

  • moveTo(x: number, y: number): void

quadTo

  • quadTo(x1: number, y1: number, x2: number, y2: number): void

rect

  • rect(x: number, y: number, w: number, h: number): void

reset

  • reset(): void

restore

  • restore(): void

rotate

  • rotate(theta: number, flipH: boolean, flipV: boolean, cx: number, cy: number): void
  • Rotates the current state.

    Parameters

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

    Returns void

rotatePoint

  • rotatePoint(x: number, y: number, theta: number, cx: number, cy: number): void
  • Rotates the given point and returns the result as an .

    Parameters

    • x: number
    • y: number
    • theta: number
    • cx: number
    • cy: number

    Returns void

roundrect

  • roundrect(x: number, y: number, w: number, h: number, dx: number, dy: number): void

save

  • save(): void

scale

  • scale(value: number): void

setAlpha

  • setAlpha(value: number): void

setDashPattern

  • setDashPattern(value: string): void

setDashed

  • setDashed(value: boolean, fixDash: boolean): void
  • Enables or disables dashed lines.

    Parameters

    • value: boolean

      specifies whether or not the lines are dashed

    • fixDash: boolean

      specifies whether or not the lines use fix dash

    Returns void

setFillAlpha

  • setFillAlpha(value: number): void

setFillColor

  • setFillColor(value: string): void

setFontBackgroundColor

  • setFontBackgroundColor(value: string): void

setFontBorderColor

  • setFontBorderColor(value: string): void

setFontColor

  • setFontColor(value: string): void

setFontFamily

  • setFontFamily(value: string): void

setFontSize

  • setFontSize(value: number): void

setFontStyle

  • setFontStyle(value: string): void

setGradient

  • setGradient(color1: string, color2: string, x: number, y: number, w: number, h: number, direction: string, alpha1: number, alpha2: number): void
  • Sets the current gradient.

    Parameters

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

    Returns void

setLineCap

  • setLineCap(value: string): void

setLineJoin

  • setLineJoin(value: string): void

setLink

  • setLink(link: string): void

setMiterLimit

  • setMiterLimit(value: number): void

setShadow

  • setShadow(enabled: boolean): void

setShadowAlpha

  • setShadowAlpha(value: number): void

setShadowColor

  • setShadowColor(value: string): void

setShadowOffset

  • setShadowOffset(dx: number, dy: number): void

setStrokeAlpha

  • setStrokeAlpha(value: number): void

setStrokeColor

  • setStrokeColor(value: string): void

setStrokeWidth

  • setStrokeWidth(value: number): void

stroke

  • stroke(): void

translate

  • translate(dx: number, dy: number): void

Generated using TypeDoc