Renderer
Enables an element to be prerendered in a hidden canvas. Once an element is prerendered it can be drawn to the main canvas faster. If an element has not changed, then prerendered version will be used, thus optimizing the application.
Constructor Summary
Public Constructor | ||
public |
constructor(opts: object) |
Member Summary
Public Members | ||
public |
Sets if the rendered image will be drawn with respect to the axis of the world or not. |
|
public |
Function used to set the drawing procedure for the renderer. |
|
public |
callbackArgs: * Arguments passed to the callback function used to draw onto the renderer. |
|
public |
Canvas element where the object will be prerendered. |
|
public |
Context of the canvas element where the object will be prerendered. |
|
public |
Flag for switching the renderer on or off. |
|
public |
Sets if the target object is an axis. |
|
public |
Sets the object that will be prerendered. |
|
public |
Flag for signaling when then object has been drawn in the hidden canvas. |
|
public |
Sets the reference to the world object. |
Method Summary
Public Methods | ||
public |
begin() Starts the drawing process of the rendered canvas on the world canvas. |
|
public |
end() Finishes the drawing process of the rendered canvas on the world canvas. |
|
public |
render() Set the flags required to start the rendering process. |
|
public |
setCallback(f: function, args: *) Sets the callback function for when the renderer is drawn. |
Private Methods | ||
private |
draw() Draws the rendered canvas onto the world canvas. |
|
private |
resize() Resizes the rendered canvas to match the size of the world's canvas. It is automatically called when the canvas gets resized. |
|
private |
Sets the world object used by the renderer. |
Public Constructors
Public Members
public absolute: boolean source
Sets if the rendered image will be drawn with respect to the axis of the world or not. Default value is false.
public callbackArgs: * source
Arguments passed to the callback function used to draw onto the renderer.
public enabled: boolean source
Flag for switching the renderer on or off. If it is set to false, then the object will be drawn normally on the main canvas. Default value is true.
public isAxis: boolean source
Sets if the target object is an axis. It is important to set this property for all axis objects. Default value is false.
Public Methods
public begin() source
Starts the drawing process of the rendered canvas on the world canvas. It sets the translation depending on the value of Renderer.absolute.
public render() source
Set the flags required to start the rendering process. The flag Renderer.enabled is set to true and the flag Renderer.rendered is set to false.
public setCallback(f: function, args: *) source
Sets the callback function for when the renderer is drawn.
Params:
Name | Type | Attribute | Description |
f | function | Callback function. |
|
args | * | Arguments passed to the callback function when called. |
Private Methods
private resize() source
Resizes the rendered canvas to match the size of the world's canvas. It is automatically called when the canvas gets resized.