Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PDFCanvas

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _ctx

_ctx: CanvasRenderingContext2D

Private _diagram

_diagram: Diagram

Private _height

_height: number

Private _offsetX

_offsetX: number

Private _offsetY

_offsetY: number

Private _pdf

_pdf: PDF

Private _width

_width: number

Private _zoom

_zoom: number

Accessors

background

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

diagram

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

rerender

  • rerender(): this

resize

  • resize(width: number, height: number): this

saveToFile

  • saveToFile(filename: string, jpegOptions?: JPEGOptions): Promise<void>

strokeRectangle

toDataURL

  • toDataURL(): string

translate

  • translate(offset: Point): void

Protected zoomCanvas

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

Generated using TypeDoc