Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbstractCanvas

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private _background

_background: string | null

Protected _ctx

_ctx: CanvasRenderingContext2D

Private _diagram

_diagram: Diagram | null

Private _grid

_grid: boolean

Private _gridX

_gridX: number

Private _gridY

_gridY: number

Private _offsetX

_offsetX: number

Private _offsetY

_offsetY: number

Private _zoom

_zoom: number

Accessors

background

  • get background(): string | any
  • set background(value: string | any): void

diagram

  • get diagram(): Diagram | null
  • set diagram(val: Diagram | null): void

grid

  • get grid(): boolean
  • set grid(val: boolean): void

gridX

  • get gridX(): number

gridY

  • get gridY(): number

height

  • get height(): number

offsetX

  • get offsetX(): number

offsetY

  • get offsetY(): number

width

  • get width(): number

zoom

  • get zoom(): number
  • set zoom(value: number): void

zoomHeight

  • get zoomHeight(): number

zoomWidth

  • get zoomWidth(): number

Methods

clipRectangle

  • clipRectangle(bounds: Bounds): void

drawLine

drawRectangle

  • drawRectangle(bounds: Bounds): void

drawSimpleLine

  • drawSimpleLine(x1: number, y1: number, x2: number, y2: number, stroke: Stroke): void

drawText

  • drawText(text: string, x: number, y: number, font: Font, maxWidth?: undefined | number, hAlign?: TextAlign, vAlign?: Baseline): void
  • Draws a text

    Parameters

    • text: string

      The text to draw

    • x: number

      The text X position

    • y: number

      The text Y position

    • font: Font

      The font to use

    • Optional maxWidth: undefined | number

      The maximum width of the text

    • Default value hAlign: TextAlign = "left"

      The horizontal alignment

    • Default value vAlign: Baseline = "middle"

      The vertical alignment

    Returns void

fillRectangle

Protected getElementCoordinates

  • getElementCoordinates(target: DiagramElement<any>): [number, number]

Protected invalidate

  • invalidate(): void

labelLine

  • labelLine(line: Line, font: Font, label: string, position?: number): void

measureTextWidth

  • measureTextWidth(text: string, font: Font): number

moveOffset

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

popCanvasStack

  • popCanvasStack(): void

pushCanvasStack

  • pushCanvasStack(): void

Protected render

  • render(): this

Private renderGrid

  • renderGrid(): void

rerender

  • rerender(): this

resize

  • resize(width: number, height: number): this
  • Resizes the canvas

    Parameters

    • width: number

      The new width of the canvas

    • height: number

      The new height of the canvas

    Returns this

strokeRectangle

translate

  • translate(offset: Point): void

Protected zoomCanvas

  • zoomCanvas(newZoom: number, x?: undefined | number, y?: undefined | number): void
  • Parameters

    • newZoom: number
    • Optional x: undefined | number
    • Optional y: undefined | number

    Returns void

Generated using TypeDoc