Class: DrawFuncRegistry

algeobraCanvas~DrawFuncRegistry(params)

Class to bundle a number of drawing functions for differently typed objects A default drawing function can be provided to handle all-non provided typed objects An drawing function for untyped objects allows to draw arbitrary objects

Constructor

new DrawFuncRegistry(params)

A drawing function has the same signature as DrawFuncRegistry.draw All of the provided fields can be changed later as well
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
typedDrawFuncs Object <optional>
A map of typename -> drawing function pairs
defaultDrawFunc function <optional>
The function called for non registered types
untypedDrawFunc function <optional>
The drawing function for general untyped objects
Source:

Methods

draw(output, object, properties)

Draw an object to an output
Parameters:
Name Type Description
output Object The output object. Must be compatible with the registered functions
object Object The object to be drawn
properties Object Properties corresponding to the object
Source: