Constructor
#
new module:Container(positionDefinitionopt, optionsopt)
Parameters:
Name |
Type |
Attributes |
Description |
positionDefinition |
PositionDefinition
|
<optional>
|
Position in its container |
options |
ContainerOptions
|
<optional>
|
Specific options |
Extends
Members
#
(static) defaultOptions :ContainerOptions
#
(static) events :ContainerEvent
#
children :Array.<Container>
#
frameCount :Number
#
options :ContainerOptions
#
parent :Container
#
position :Position
Methods
#
(static) from(definition) → {Container}
Return an instance from a generic object
Parameters:
Name |
Type |
Description |
definition |
Object
|
Container definition |
#
(static) setOpacity(ctx, opacity)
Parameters:
Name |
Type |
Description |
ctx |
CanvasRenderingContext2D
|
Drawing context |
opacity |
Number
|
Opacity value |
#
add(…child) → {Container}
Add another container as a child
Parameters:
Name |
Type |
Attributes |
Description |
child |
Container
|
<repeatable>
|
Another container |
#
climbAncestry(callback, untilopt)
Execute an action on every ancestor of this
Parameters:
Name |
Type |
Attributes |
Default |
Description |
callback |
ancestryCallback
|
|
|
Function to execute on each ancestor |
until |
Container
|
<optional>
|
null
|
Define a ancestor where to stop the climbing |
#
clone() → {Container}
Create a copy of any descendant of Container
#
delete() → {Container}
Remove itself from its parent
#
empty() → {Container}
#
fire(event) → {Container}
Bubble the event to its parent
Parameters:
Name |
Type |
Description |
event |
BaseEvent
|
Event to fire |
#
getAbsolutePosition() → {Position}
Get this container's absolute position (up to it's utmost parent)
#
getRoot() → {Container}
Return its highest parent
#
getScene() → {Promise.<Scene>}
Return a promise for the associated scene
Returns:
-
Type
-
Promise.<Scene>
#
getTarget(position, ctx) → {Container}
Find the target at a position
Parameters:
Name |
Type |
Description |
position |
Position
|
Any position |
ctx |
CanvasRenderingContext2D
|
Drawing context to apply paths |
#
hide() → {Container}
#
isAncestorOf(container) → {Boolean}
Define if this is an ancestor of another container
Parameters:
Name |
Type |
Description |
container |
Container
|
Any container |
#
isHover() → {Boolean}
Container can't be hovered
#
makePath() → {Container}
Do nothing on Container, override it to add behavior
#
remove(…child) → {Container}
Remove a child from the list
Parameters:
Name |
Type |
Attributes |
Description |
child |
Container
|
<repeatable>
|
Child to remove |
#
render(ctx) → {Container}
Call the render method of all children
Parameters:
Name |
Type |
Description |
ctx |
CanvasRenderingContext2D
|
Drawing context |
#
setContext(ctx) → {Container}
Set variables of the context according to specified options
Parameters:
Name |
Type |
Description |
ctx |
CanvasRenderingContext2D
|
Drawing context |
#
setOptions(optionsopt) → {Container}
Define options for this container
Parameters:
Name |
Type |
Attributes |
Default |
Description |
options |
ContainerOptions
|
<optional>
|
{}
|
Options to override |
#
show() → {Container}
#
toJSON() → {Object}
Return a json ready object
Type Definitions
#
ancestryCallback(ancestor)
Parameters:
Name |
Type |
Description |
ancestor |
Container
|
|
#
ContainerEvent
Properties
Name |
Type |
Description |
attach |
String
|
Container is append to a new parent |
detach |
String
|
Container remove from it's parent |
draw |
String
|
Container is drawn |
hide |
String
|
|
show |
String
|
|
#
ContainerOptions
Properties
Name |
Type |
Attributes |
Default |
Description |
shown |
Boolean
|
<optional>
|
true
|
Is shown |
opacity |
Number
|
<optional>
|
null
|
Opacity level from 0 to 1 (null mean inherited from parent) |
rotation |
Number
|
<optional>
|
0
|
Rotation ratio from 0 to 1 (clockwise) |
rotationCenter |
PositionDefinition
|
<optional>
|
new Position()
|
Center of rotation relative to this position |
scale |
Number
|
PositionDefinition
|
<optional>
|
1
|
Scaling ratio or a pair of value for horizontal and vertical scaling |
zIndex |
Number
|
<optional>
|
1
|
Depth ordering |
clip |
Component
|
<optional>
|
null
|
Other component used to clip the rendering |