Type Alias: RenderableContext
RenderableContext =
object
A renderable context represents the relationship of a design panel (layout) with an external canvas. This context allows a preview engine to render a panel's design to a canvas with a simple interface, without needing to know anything about how that design is generated.
Methods
getID()
getID():
string
A unique identifier for this renderable context.
Returns
string
getLastCompletedStaticRender()
getLastCompletedStaticRender():
number|undefined
A timestamp for the last successful render of the context.
Returns
number | undefined
getName()
getName():
string
A name for this renderable.
Returns
string
getPanelSize()
getPanelSize(): {
height:number;width:number; } |undefined
Returns the width and height of the workflow panel associated to this renderable context. This can be used when calculating the size of the canvas to render to. For example to make optimizations for panels containing only a flat color. This field may be undefined if no panel was associated to the context.
Returns
{ height: number; width: number; } | undefined
getStaticContext()
getStaticContext():
CanvasRenderingContext2D|undefined
Get the render context associated to this renderable.
Returns
CanvasRenderingContext2D | undefined
getStaticContextDirty()
getStaticContextDirty():
boolean
When this context has been set as dirty, returns true.
Returns
boolean
requestRerender()
requestRerender():
void
Requests that this context re-render using the last known render arguments, at whatever dimensions its current static context's canvas has. Useful when a consumer resizes the canvas (e.g. for a change in zoom or device pixel ratio) and needs a freshly rasterized frame without a design state change having occurred. No-op if nothing has been rendered yet.
Returns
void
setStaticContext()
setStaticContext(
ctx):void
Sets the render context associated to this renderable.
Parameters
ctx
CanvasRenderingContext2D
The context to use for rendering.
Returns
void
setStaticContextDirty()
setStaticContextDirty(
value):void
Sets whether or not this renderable is dirty and will need re-rendering.
Parameters
value
boolean
The new value
Returns
void