Home Reference Source
import SmartCanvas from 'canvas-gauges/lib/SmartCanvas.js'
public class | source

SmartCanvas

Drawings on canvas using hidden canvas as a cache for better performance drawings during canvas animations. SmartCanvas also adopts a canvas to

Static Member Summary

Static Public Members
public static get

Returns current device pixel ratio

Static Method Summary

Static Public Methods
public static

redraw()

Forces redraw all canvas in the current collection

Constructor Summary

Public Constructor
public

constructor(canvas: HTMLCanvasElement, width: number, height: number)

Member Summary

Public Members
public

Target drawings canvas element 2D context

public

Canvas caching element 2D context

public

Actual drawings height

public

Actual drawings width

public

X-coordinate of drawings zero point

public

Y-coordinate of drawings zero point

public

element: HTMLCanvasElement

Target drawings canvas element

public

elementClone: HTMLCanvasElement | Node

Canvas caching element

public

Canvas base height

public

Minimal side length in pixels of the drawing

public

On canvas redraw event callback

public

Canvas base width

Method Summary

Public Methods
public

commit(): *

Commits the drawings

public

Destroys this object, removing the references from memory

public

init()

Initializes canvases and contexts

public

redraw(): *

Redraw this object

Static Public Members

public static get pixelRatio: number: * source

Returns current device pixel ratio

Return:

number

Static Public Methods

public static redraw() source

Forces redraw all canvas in the current collection

Public Constructors

public constructor(canvas: HTMLCanvasElement, width: number, height: number) source

Params:

NameTypeAttributeDescription
canvas HTMLCanvasElement
width number
height number

Public Members

public context: CanvasRenderingContext2D source

Target drawings canvas element 2D context

public contextClone: CanvasRenderingContext2D source

Canvas caching element 2D context

public drawHeight: number source

Actual drawings height

public drawWidth: number source

Actual drawings width

public drawX: number source

X-coordinate of drawings zero point

public drawY: number source

Y-coordinate of drawings zero point

public element: HTMLCanvasElement source

Target drawings canvas element

public elementClone: HTMLCanvasElement | Node source

Canvas caching element

public height: number source

Canvas base height

public minSide: number source

Minimal side length in pixels of the drawing

public onRedraw: function | null | undefined source

On canvas redraw event callback

public width: number source

Canvas base width

Public Methods

public commit(): * source

Commits the drawings

Return:

*

public destroy() source

Destroys this object, removing the references from memory

public init() source

Initializes canvases and contexts

public redraw(): * source

Redraw this object

Return:

*