Class: HasScenesMixin

HasScenesMixin

HasScenesMixin is a Mixin to add a collection of Scene objects to a class.

Methods

addScene(name, scene)

Add a scene to this container with the given name.
Parameters:
Name Type Description
name String The name to assign to the scene
scene Scene The Scene to add
Source:

drawScenes(context, z)

Draw scenes in z-order
Parameters:
Name Type Default Description
context CanvasRenderingContext2D The context in which to draw
z integer null If specified, only draw scenes with this z-layer (mapped by sortScenesZ())
Source:

getScene(name) → {Scene}

Return the scene with the given name. Throws an exception if the scene is not found.
Parameters:
Name Type Description
name String The name of the scene to return
Source:
Throws:
'Scene not found' if the scene is not found
Type
Exception
Returns:
The Scene with the given name if found
Type
Scene

getScenesAtLayer(z)

Get scenes from a particular layer
Parameters:
Name Type Description
z integer Scene z-order to get (mapped by sortScenesZ())
Source:

redrawScenes()

Call redraw on all scenes in this container by calling redraw()
Source:

removeScene(name)

Remove a named scene from this container, will trigger a redraw if defined on the container class
Parameters:
Name Type Description
name String The name of the scene to remove
Source:

sortScenesZ()

Recalculate the draw order of all scenes based on their Z coordinate and store internally, for use by drawScenes()) and getScenesAtLayer())
Source: