Stage

Stage: controls a list of layer groups and their synchronisation.

Constructor

new Stage()

Methods

addLayerGroup(htmlElement) → {LayerGroup}

Add a layer group to the list.

The new layer group will be marked as the active layer group.

Parameters:
NameTypeDescription
htmlElementobject

The HTML element of the layer group.

Returns:

The newly created layer group.

Type: 
LayerGroup

bindLayerGroups()

Bind the layer groups of the stage.

draw()

Draw the stage: calls draw on all layer groups.

empty()

Empty the layer group list.

fitToContainer()

Fit to container: synchronise the div to world size ratio of the group layers.

getActiveLayerGroup() → {LayerGroup|undefined}

Get the active layer group.

Returns:

The layer group.

Type: 
LayerGroup | undefined

getDrawLayers(callbackFnopt) → {Array.<DrawLayer>}

Get a list of draw layers according to an input callback function.

Parameters:
NameTypeAttributesDescription
callbackFnfunction<optional>

A function that takes a DrawLayer as input and returns a boolean. If undefined, returns all draw layers.

Returns:

The layers that satisfy the callbackFn.

Type: 
Array.<DrawLayer>

getDrawLayersByDataId(dataId) → {Array.<DrawLayer>}

Get the draw layers associated to a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The layers.

Type: 
Array.<DrawLayer>

getLayerGroup(index) → {LayerGroup|undefined}

Get the layer group at the given index.

Parameters:
NameTypeDescription
indexnumber

The index.

Returns:

The layer group.

Type: 
LayerGroup | undefined

getLayerGroupByDivId(id) → {LayerGroup}

Get a layer group from an HTML element id.

Parameters:
NameTypeDescription
idstring

The element id to find.

Returns:

The layer group.

Type: 
LayerGroup

getNumberOfLayerGroups() → {number}

Get the number of layer groups that form the stage.

Returns:

The number of layer groups.

Type: 
number

getViewLayers(callbackFnopt) → {Array.<ViewLayer>}

Get a list of view layers according to an input callback function.

Parameters:
NameTypeAttributesDescription
callbackFnfunction<optional>

A function that takes a ViewLayer as input and returns a boolean. If undefined, returns all view layers.

Returns:

The layers that satisfy the callbackFn.

Type: 
Array.<ViewLayer>

getViewLayersByDataId(dataId) → {Array.<ViewLayer>}

Get the view layers associated to a data id.

Parameters:
NameTypeDescription
dataIdstring

The data id.

Returns:

The layers.

Type: 
Array.<ViewLayer>

removeLayerGroup(layerGroup)

Remove a layer group from this stage.

Parameters:
NameTypeDescription
layerGroupLayerGroup

The layer group to remove.

removeLayersByDataId(dataId)

Remove all layers for a specific data.

Parameters:
NameTypeDescription
dataIdstring

The data to remove its layers.

reset()

Reset the stage: calls reset on all layer groups.

setActiveLayerGroup(index)

Set the active layer group.

Parameters:
NameTypeDescription
indexnumber

The layer group index.

setBinders(list)

Set the layer groups binders.

Parameters:
NameTypeDescription
listArray

The list of binder objects.

setImageSmoothing(flag)

Set the imageSmoothing flag value.

Parameters:
NameTypeDescription
flagboolean

True to enable smoothing.

unbindLayerGroups()

Unbind the layer groups of the stage.