Visual
Base class for all visual elements in Ceramic.
Visuals are the building blocks to display things on screen. While a raw Visual doesn't render anything by itself, it serves as a container for other visuals and provides core functionality like transformation, hierarchy, and event handling.
Specialized visual classes like Quad, Mesh, Text, etc. extend this class to provide actual rendering capabilities.
Key features:
- Hierarchical parent-child relationships
- Transform properties (position, scale, rotation, skew)
- Event handling (pointer events, focus)
- Depth sorting and rendering order
- Hit testing and touch input
- Shader and blend mode support
Example usage:
var visual = new Visual();
visual.pos(100, 100);
visual.size(200, 150);
visual.onPointerDown(this, info -> {
trace('Visual clicked at ${info.x}, ${info.y}');
});
Instance Members
asQuad: Quad
Get this visual typed as Quad
or null if it isn't a Quad
asMesh: Mesh
Get this visual typed as Mesh
or null if it isn't a Mesh
multiTouch: Bool
When enabled, this visual will receive as many up/down/click/over/out events as
there are fingers or mouse pointer interacting with it.
Default is false
, ensuring there is never multiple up/down/click/over/out that
overlap each other. In that case, it triggers pointer down
when the first finger/pointer hits
the visual and trigger pointer up
when the last finger/pointer stops touching it. Behavior is
similar for pointer over
and pointer out
events.
isPointerDown: Bool
Whether this visual is between a pointer down
and an pointer up
event or not.
isPointerOver: Bool
Whether this visual is between a pointer over
and an pointer out
event or not.
clip: Visual
Use the given visual's bounds as clipping area for itself and every children.
Clipping areas cannot be combined. That means if clip
is not null and current
visual instance is already clipped by a parent visual, its children's won't be clipped
by it anymore as they are instead clipped by this clip
property instead.
inheritAlpha: Bool
Whether this visual should inherit its parent alpha value or not.
If it inherits, parent alpha value will be multiplied with current visual's own alpha
property.
translatesOnly: Bool
Computed flag that tells whether this visual is only translated,
thus not rotated, skewed nor scaled.
When this is true
, matrix computation may be a bit faster as it
will skip some unneeded matrix computation.
translatesOnlyDirty: Bool
Whether we should re-check if this visual is only translating or having a more complex transform
contentDirty: Bool
Setting this to true will force the visual to recompute its displayed content
matrixDirty: Bool
Setting this to true will force the visual's matrix to be re-computed
renderTargetDirty: Bool
Setting this to true will force the visual's computed render target to be re-computed
visibilityDirty: Bool
Setting this to true will force the visual to compute it's visility in hierarchy
touchableDirty: Bool
Setting this to true will force the visual to compute it's touchability in hierarchy
clipDirty: Bool
Setting this to true will force the visual to compute it's clipping state in hierarchy
renderTarget: RenderTexture
If set, the visual will be rendered into this target RenderTexture instance instead of being drawn onto screen directly.
blending: Blending
The blending to use for this visual.
visible: Bool
Set to false
to make this visual (and all of its children) invisible and not rendered.
touchable: Bool
Set to false
to make this visual (and all of its children) not touchable
depth: Float
Set this visual's depth.
Visuals are rendered from back to front of the screen.
Given two visuals, a visual with higher depth will be rendered above a visual with lower depth.
In practice, it is advised to use integer values like 1
, 2
, 3
... to order your visuals,
like you would do with z-index on CSS elements.
depthRange: Float
If set to 1
(default), children will be sort by depth and their computed depth
will be within range [parent.depth, parent.depth + depthRange].
You'll usually won't need to change this value,
unless you want to do advanced drawing where different
hierarchies of visuals are blending with each other.
// Children computed depths will be relative to their parent visual depth.
// This is the default value and recommended approach in most situations as
// its behaviour is similar to display trees, z-index etc...
visual.depthRange = 1;
// More advanced, two visuals: visual2 above visual1 because of higher depth, but
// visual1's depth range is `8`, so its children computed depths will be distributed
// between `1` and `1 + 8` (9 excluded). That means some of visual1's children
// can be above visual2's children. Can be useful on some specific edge cases,
// but not recommended in general.
visual1.depthRange = 8;
visual1.depth = 1;
visual2.depth = 2;
// Another case: two visuals with the same depth and depthRange.
// There children will share the same computed depth space, so a child of visual1 at `depth = 6`
// will be above a child of visual2 at `depth = 4`.
// Resulting computed depths will be between `1` and `1 + 16` (17 excluded).
visual1.depthRange = 16
visual2.depthRange = 16
visual1.depth = 1;
visual2.depth = 1;
// Children computed depths won't be relative to their parent visual depth.
// Instead, it will be relative to the higher parent (of the parent) in hierarchy that has a positive `depthRange` value,
visual.depthRange = -1;
x: Float
The x position of this visual. Relative to its parent, or screen if this visual has no parent.
y: Float
The y position of this visual. Relative to its parent, or screen if this visual has no parent.
scaleX: Float
The scaleX value of this visual.
scaleY: Float
The scaleY value of this visual.
skewX: Float
The skewX value of this visual.
skewY: Float
The skewY value of this visual.
anchorX: Float
The anchorX value of this visual.
Affects how position, scale, rotation and skew of the visual are rendered.
Default is 0
, which means: anchor relative to the left of the visual.
Use 1
to make it relative to the right of the visual, or 0.5
to make it
relative to the horizontal center of the visual.
anchorY: Float
The anchorY value of this visual.
Affects how position, scale, rotation and skew of the visual are rendered.
Default is 0
, which means: anchor relative to the top of the visual.
Use 1
to make it relative to the bottom of the visual, or 0.5
to make it
relative to the vertical center of the visual.
width: Float
The width of the visual.
Default is 0
. Can be set to an explicit value.
Some subclasses of Visual
are computing it automatically
like Text
from its textual content or Quad
when a texture is assigned to it.
height: Float
The height of the visual.
Default is 0
. Can be set to an explicit value.
Some subclasses of Visual
are computing it automatically
like Text
from its textual content or Quad
when a texture is assigned to it.
roundTranslation: Int
If set to a value above zero, matrix translation (tx & ty) will be rounded.
roundTranslation = 0; // No rounding (default)
roundTranslation = 1; // Pixel perfect rounding
roundTranslation = 2; // Half-pixel rounding
May be useful to render pixel perfect scenes onto ceramic.Filter
.
rotation: Float
Rotation of the visual in degrees.
The center of the rotation depends on anchorX
and anchorY
.
alpha: Float
Alpha of the visual. Must be a value between 0
(transparent) and 1
(fully opaque)
translateX: Float
Visual X translation.
This is a shorthand equivalent to assigning a Transform
object to
the visual with a tx
value of translateX
.
Only recommended for advanced usage as x
property should be used in general instead.
translateY: Float
Visual Y translation.
This is a shorthand equivalent to assigning a Transform
object to
the visual with a ty
value of translateY
.
Only recommended for advanced usage as y
property should be used in general instead.
transform: Transform
Set additional matrix-based transform to this visual. Default is null
.
A Transform
object will affect of the visual is rendered.
The transform is applied after visual's properties (position, rotation, scale, skew).
shader: Shader
Assign a shader to this visual. When none is assigned, default shader will be used.
active: Bool
Whether this visual is active
. Default is true. When setting it to false,
the visual won't be visible
nor touchable
anymore (these get set to false).
When restoring active
to true, visible
and touchable
will also get back
their previous state.
If you want to keep a visual around without it being displayed or interactive, simply
set its active
property to false
. It will be almost like it doesn't exist and its
impact on rendering will be minimal.
computedVisible: Bool
Computed visible value. This is true
if this visual is visible
and all
of its parents are visible
. If you want to know if a visual is visible on screen,
you should check with this property and not visible
property, which doesn't account
for parent visibility.
computedAlpha: Float
Computed alpha value. This is the combination of this visual's alpha and its parent alpha
if inheritAlpha
is true
computedDepth: Float
Computed depth value. This is the final depth used by rendering, computed from this visual's depth
and depthRange
properties and its hierarchy of parent visuals.
computedRenderTarget: RenderTexture
Computed render target. When a visual has a renderTarget
assigned, its computedRenderTarget
will
be assigned with the same instance, and its children's computedRenderTarget
property as well.
computedTouchable: Bool
Computed touchable value. This is true
if this visual is touchable
and all
of its parents are touchable
.
computedClip: Visual
If any parent of this visual has a clip
visual assigned, this will be the computed/resolved visual.
children: ReadOnlyArray<Visual>
A visual can have children.
Children positions and transformations are relative to their parent.
This property is read only. Use add()
to add children to this visual
and remove()
to remove them.
The order on the visuals in children
should not be used to predict the order in which visuals are rendered.
If you want to control the order of rendering of visuals, use depth
property on the children instead.
parent: Visual
The parent visual if there is any, or null
if this visual doesn't have any parent.
stop(): Void
Stop this visual, whatever that means (override in subclasses). When arcade physics are enabled, visual's body is stopped from this call.
Read and write arbitrary boolean flags on this visual. Index should be between 0 (included) and 16 (excluded) or result is undefined.
Name | Type | Default | Description |
---|---|---|---|
index |
Int | The index of the flag to change, between 0 (included) and 16 (excluded) | |
value |
Bool | (optional) | (optional) The boolean value to set, or no value to simply read current value |
Returns | Description |
---|---|
Bool | The existing value if just reading, or the new value if writing |
Shorthand to set width
and height
in a single call.
Name | Type | Description |
---|---|---|
width |
Float | The width to set to the visual |
height |
Float | The height to set to the visual |
Shorthand to set anchorX
and anchorY
in a single call.
Name | Type | Description |
---|---|---|
anchorX |
Float | The anchor to set to the visual on x axis |
anchorY |
Float | The anchor to set to the visual on y axis |
Shorthand to set x
and y
in a single call.
Name | Type | Description |
---|---|---|
x |
Float | The x position to set to the visual |
y |
Float | The y position to set to the visual |
Shorthand to set scaleX
and scaleY
in a single call.
Name | Type | Description |
---|---|---|
scaleX |
Float | The scale to set to the visual on x axis |
Shorthand to set skewX
and skewY
in a single call.
Name | Type | Description |
---|---|---|
skewX |
Float | The skew to set to the visual on x axis |
skewY |
Float | The skew to set to the visual on y axis |
Shorthand to set translateX
and translateY
in a single call.
Name | Type | Description |
---|---|---|
translateX |
Float | The translation to set to the visual on x axis |
translateY |
Float | The translation to set to the visual on y axis |
Change the visual's anchor but ensure the visual keeps its current position.
This is similar to anchor(anchorX, anchorY)
but visual with have its x
and y
properties
updated to ensure it stays at the same position as before changing anchor.
Name | Type | Description |
---|---|---|
anchorX |
Float | The anchor to set to the visual on x axis |
anchorY |
Float | The anchor to set to the visual on y axis |
Returns the first child matching the requested id
or null
otherwise.
Name | Type | Default | Description |
---|---|---|---|
id |
String | The requested id | |
recursive |
Bool | true |
(optional) Recursive search in children |
Returns | Description |
---|---|
Visual | A matching visual or null |
Returns the first child matching the requested type or null
otherwise.
Name | Type | Default | Description |
---|---|---|---|
type |
Class<childWithType.T> | The requested type | |
recursive |
Bool | true |
(optional) Recursive search in children |
Returns | Description |
---|---|
childWithType.T | A matching visual or null |
destroy(): Void
Destroy the visual.
When a visual is destroyed, clear()
is called,
which means all children are removed and destroyed.
Events owned by this visual and events on this visual are
unbound so they don't need to be unbound explicitly.
As soon as destroy()
is called, the destroyed
property
becomes true
.
clear(): Void
Remove and destroy all children.
Returns true if screen (x, y) screen coordinates hit/intersect this visual visible bounds
Name | Type | Description |
---|---|---|
x |
Float | Screen x coordinate |
y |
Float | Screen y coordinate |
Returns | Description |
---|---|
Bool | true if it hits |
Assign x and y to given point after converting them from screen coordinates to current visual coordinates.
Name | Type | Default | Description |
---|---|---|---|
x |
Float | The x coordinate | |
y |
Float | The y coordinate | |
point |
Point | The point in which resulting x and y coordinate are stored | |
handleFilters |
Bool | true |
(optional) Make it false if you want to skip nested filter transformations |
Assign x and y to given point after converting them from current visual coordinates to screen coordinates.
Name | Type | Default | Description |
---|---|---|---|
x |
Float | The x coordinate | |
y |
Float | The y coordinate | |
point |
Point | The point in which resulting x and y coordinate are stored | |
handleFilters |
Bool | true |
(optional) Make it false if you want to skip nested filter transformations |
Extract current visual transformation and write it into the given transform
Name | Type | Description |
---|---|---|
transform |
Transform | The transform object to write data into |
computeContent(): Void
Compute content on this visual.
This method is expected to be overrided in Visual
subclasses
to compute actual content (raw Visual
class doesn't do anything).
Will walk on every children and set their depths starting from
start
and incrementing depth by step
.
Name | Type | Default | Description |
---|---|---|---|
start |
Float | 1 |
The depth starting value (default 1). First child will have this depth, next child depthStart + depthStep etc... |
step |
Float | 1 |
The depth step to use when increment depth for each child |
sortChildrenByDepth(): Void
Sort children by depth in ascending order.
This will simply reorder children in children
array.
No depth value will be changed on any child.
This is the equivalent of calling sortChildrenByDepth()
followed with autoChildrenDepth()
Name | Type | Default | Description |
---|---|---|---|
start |
Float | 1 |
The depth starting value (default 1). First child will have this depth, next child depthStart + depthStep etc... |
step |
Float | 1 |
The depth step to use when increment depth for each child |
Check if current visual has targetParent
as parent visual. The parent can possibly
be indirect, meaning it can be the parent of the parent of the visual etc...
Name | Type | Description |
---|---|---|
targetParent |
Visual | The target parent to check |
Returns | Description |
---|---|
Bool | true if the visual has the given target parent as indirect parent |
firstParentWithClass(clazz: Class<firstParentWithClass.T>): firstParentWithClass.T
Returns the first parent (can be indirect) of this visual that matches
the given class or null
if none is matching
Name | Type | Description |
---|---|---|
clazz |
Class<firstParentWithClass.T> | The requested class |
Returns | Description |
---|---|
firstParentWithClass.T | A matching parent or null |
Add the given visual as a child.
When a visual is added as a child, it's parent
property is updated
and it will follow parent transformation in addition to its own.
Name | Type | Description |
---|---|---|
visual |
Visual | The visual to add |
Remove the child from current visual.
Name | Type | Description |
---|---|---|
visual |
Visual | The child to remove |
Returns true
if the current visual contains this child.
When recursive
option is true
, will return true
if
the current visual contains this child or one of
its direct or indirect children does.
Name | Type | Default | Description |
---|---|---|---|
child |
Visual | The child to check in hierarchy | |
recursive |
Bool | false |
(optional) Set to true to search recursively on indirect children |
Returns | Description |
---|---|
Bool | true if the current visual contains this child |
computeBounds(): Void
Compute bounds from children this visual contains. This overwrites width, height, anchorX and anchorY properties accordingly. Warning: this may be an expensive operation.
bindToNativeScreenSize(): Void
Will set this visual size to native screen size.
This is different than bindToScreenSize()
because it will ignore
logical screen scaling. Use that if you want to provide visuals
that should keep the same pixel size when the window changes size and scales its content.
If needed, a Transform
instance will be created and assigned to transform
property.
Will set this visual size to screen size
Name | Type | Default |
---|---|---|
factor |
Float | 1.0 |
bindToTargetSize(): Void
Will set this visual size to target size (settings.targetWidth
and settings.targetHeight
)
new(): Void
Create a new Visual
The arcade physics body bound to this visual.
The arcade physics body linked to this visual
Allow this visual to be rotated by arcade physics, via angularVelocity
, etc...
An immovable visual will not receive any impacts from other visual bodies. Two immovable visuas can't separate or exchange momentum and will pass through each other.
If set to true
, arcade world will always separate on the X axis before Y when this body is involved. Otherwise it will check gravity totals first.
The x velocity, or rate of change the visual position. Measured in points per second.
The y velocity, or rate of change the visual position. Measured in points per second.
The maximum x velocity that the visual can reach.
The maximum y velocity that the visual can reach.
The x acceleration is the rate of change of the x velocity. Measured in points per second squared.
The y acceleration is the rate of change of the y velocity. Measured in points per second squared.
Allow this visual to be influenced by drag
The x drag is the rate of reduction of the x velocity, kind of deceleration. Measured in points per second squared.
The y drag is the rate of reduction of the y velocity, kind of deceleration. Measured in points per second squared.
The x elasticity of the visual when colliding. bounceX = 1
means full rebound, bounceX = 0.5
means 50% rebound velocity.
The y elasticity of the visual when colliding. bounceY = 1
means full rebound, bounceY = 0.5
means 50% rebound velocity.
Enable or disable world bounds specific bounce value with worldBounceX
and worldBounceY
.
Disabled by default, meaning bounceX
and bounceY
are used by default.
The x elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceX
used instead).
The y elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceY
used instead).
The maximum x delta per frame. 0
(default) means no maximum delta.
The maximum y delta per frame. 0
(default) means no maximum delta.
Allow this visual to be influenced by gravity, either world or local.
This visual's local y gravity, added to any world gravity, unless allowGravity
is set to false.
This visual's local x gravity, added to any world gravity, unless allowGravity
is set to false.
If this visual is immovable
and moving, and another visual body is 'riding' this one, this is the amount of motion the riding body receives on x axis.
If this visual is immovable
and moving, and another visual body is 'riding' this one, this is the amount of motion the riding body receives on y axis.
The angular velocity is the rate of change of the visual's rotation. It is measured in degrees per second.
The maximum angular velocity in degrees per second that the visual can reach.
The angular acceleration is the rate of change of the angular velocity. Measured in degrees per second squared.
The angular drag is the rate of reduction of the angular velocity. Measured in degrees per second squared.
The mass of the visual's body. When two bodies collide their mass is used in the calculation to determine the exchange of velocity.
The speed of the visual's body (read only). Equal to the magnitude of the velocity.
Whether the physics system should update the visual's position and rotation based on its velocity, acceleration, drag, and gravity.
When this visual's body collides with another, the amount of overlap (x axis) is stored here.
When this visual's body collides with another, the amount of overlap (y axis) is stored here.
If a visual's body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true
.
A visual body can be set to collide against the world bounds automatically and rebound back into the world if this is set to true. Otherwise it will leave the world.
Init arcade physics (body) bound to this visual.
Name | Type | Default | Description |
---|---|---|---|
world |
ArcadeWorld | (optional) | * (optional) A world instance where the body will be attached. If none is provided, default world (app.arcade.world) will be used. |
Returns | Description |
---|---|
VisualArcadePhysics | A VisualArcadePhysics instance |
Set velocity, or rate of change of the visual position. Measured in points per second.
Name | Type | Description |
---|---|---|
velocityX |
Float | The velocity on x axis |
velocityY |
Float | The velocity on y axis |
Set maximum velocity that the visual can reach.
Name | Type | Description |
---|---|---|
maxVelocityX |
Float | The max velocity on x axis |
maxVelocityY |
Float | The max velocity on y axis |
Set acceleration, which is the rate of change of the velocity. Measured in points per second squared.
Name | Type | Description |
---|---|---|
accelerationX |
Float | The acceleration on x axis |
accelerationY |
Float | The acceleration on y axis |
Set drag, which is the rate of reduction of the velocity, kind of deceleration. Measured in points per second squared.
Name | Type | Description |
---|---|---|
dragX |
Float | The drag value on x axis |
dragY |
Float | The drag value on y axis |
Set elasticity of the visual when colliding. 1
means full rebound, 0.5
means 50% rebound velocity.
Name | Type | Description |
---|---|---|
bounceX |
Float | The bounce value on x axis |
bounceY |
Float | The bounce value on y axis |
The elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceY
used instead).
Name | Type | Description |
---|---|---|
worldBounceX |
Float | The elasticity value on x axis |
worldBounceY |
Float | The elasticity value on y axis |
The max delta, or rate of change the visual position. Measured in points per second.
Name | Type | Description |
---|---|---|
maxDeltaX |
Float | The max delta value on x axis |
maxDeltaY |
Float | The max delta value on y axis |
This visual's local gravity, added to any world gravity, unless allowGravity
is set to false.
Name | Type | Description |
---|---|---|
gravityX |
Float | The gravity on x axis |
gravityY |
Float | The gravity on y axis |
If this visual is immovable
and moving, and another visual body is 'riding' this one, this is the amount of motion the riding body receives on x & y axis.
Name | Type | Description |
---|---|---|
frictionX |
Float | The friction on x axis |
frictionY |
Float | The friction on y axis |
The nape physics (body) of this visual.
initNapePhysics(type: Anonymous, ?space: nape.space.Space, ?shape: nape.shape.Shape, ?shapes: Array<nape.shape.Shape>, ?material: nape.phys.Material): VisualNapePhysics
Init nape physics body bound to this visual.
Name | Type | Default | Description |
---|---|---|---|
type |
Anonymous | Physics body type (STATIC , KINEMATIC or DYNAMIC ) |
|
space |
nape.space.Space | (optional) | (optional) Related nape spaces. Will use default space if not provided. |
shape |
nape.shape.Shape | (optional) | (optional) Shape used for this body. Default is a box matching visual bounds. |
shapes |
Array<nape.shape.Shape> | (optional) | (optional) Array of shapes used for this body. |
material |
nape.phys.Material | (optional) | (optional) A custom material to use with this body. |
Returns | Description |
---|---|
VisualNapePhysics | A VisualNapePhysics instance |
Private Members
FLAG_NOT_ACTIVE: Int
FLAG_VISIBLE_WHEN_ACTIVE: Int
FLAG_TOUCHABLE_WHEN_ACTIVE: Int
FLAG_IS_HIT_VISUAL: Int
FLAG_ARCADE_BODY_ENABLE: Int
flags: Flags
Just a way to store some flags.
32 boolean values stored inside an Int
.
isHitVisual: Bool
Compute children depth. The result depends on whether
a parent defines a custom depthRange
value or not.
Name | Type |
---|---|
visual |
Visual |
Name | Type |
---|---|
visual |
Visual |
Name | Type |
---|---|
visual |
Visual |
startDepth |
Float |
targetRange |
Float |
Fired when a pointer (touch or mouse) is down on the visual
Name | Type | Description |
---|---|---|
info |
TouchInfo | The info related to this pointer event |
Fired when a pointer (touch or mouse) was down on the visual and is not anymore
Name | Type | Description |
---|---|---|
info |
TouchInfo | The info related to this pointer event |
Fired when a pointer (touch or mouse) is over the visual
Name | Type | Description |
---|---|---|
info |
TouchInfo | The info related to this pointer event |
Fired when a pointer (touch or mouse) was over the visual and is not anymore
Name | Type | Description |
---|---|---|
info |
TouchInfo | The info related to this pointer event |
emitFocus(): Void
Fired when this visual gains focus (after handling a pointer event)
emitBlur(): Void
Fired when this visual loses focus
willListenPointerOver(): Void
Dispatched when this visual body collides with another visual's body.
Name | Type | Description |
---|---|---|
visual1 |
Visual | This visual |
visual2 |
Visual | The other colliding visual |
Dispatched when this visual body overlaps with another visual's body.
Name | Type | Description |
---|---|---|
visual1 |
Visual | This visual |
visual2 |
Visual | The other overlapping visual |
emitCollideBody(visual: Visual, body: arcade.Body): Void
Dispatched when this visual body collides with another body.
Name | Type | Description |
---|---|---|
visual |
Visual | This visual |
body |
arcade.Body | The other colliding body |
emitOverlapBody(visual: Visual, body: arcade.Body): Void
Dispatched when this visual body overlaps with another body.
Name | Type | Description |
---|---|---|
visual |
Visual | The visual |
body |
arcade.Body | The other overlapping body |
Dispatched when this visual body collides with the world bounds.
Name | Type | Description |
---|---|---|
visual |
Visual | This visual |
up |
Bool | true if visual collides up with bounds |
down |
Bool | true if visual collides down with bounds |
left |
Bool | true if visual collides left with bounds |
right |
Bool | true if visual collides right with bounds |
Read and write arbitrary boolean flags on this visual. Index should be between 0 (included) and 16 (excluded) or result is undefined. /!\ Reserved for internal use
Name | Type | Default |
---|---|---|
index |
Int | |
value |
Bool | (optional) |
Returns |
---|
Bool |
transformDidChange(): Void
Called when this visual's transform has changed
computeMatrix(): Void
Called when this visual's matrix needs to be recomputed
computeTranslatesOnly(): Void
doComputeMatrix(): Void
The actual hit test performed on the visual. If needed to change how hit test is performed on a visual subclass, this is the method to override.
Name | Type | Description |
---|---|---|
x |
Float | Screen x coordinate |
y |
Float | Screen y coordinate |
matrix |
Transform | The matrix being applied to visual, relative to screen space |
Returns | Description |
---|---|
Bool | true if it hits |
interceptPointerDown(hittingVisual: Visual, x: Float, y: Float, touchIndex: Int, buttonId: Int): Bool
Override this method in subclasses to intercept hitting pointer down events on this visual's children (any level in sub-hierarchy).
Return true
to stop an event from being triggered on the hitting child, false
(default) otherwise.
Name | Type | Description |
---|---|---|
hittingVisual |
Visual | The hitting visual, meaning the visual on which the event applies |
x |
Float | The x coordinate of the event |
y |
Float | The y coordinate of the event |
touchIndex |
Int | The touch index of the event (or -1 if it is not a touch event) |
buttonId |
Int | The button id of the event (or -1 if it is not a mouse event) |
Returns | Description |
---|---|
Bool | true if the event is intercepted |
Override this method in subclasses to intercept hitting pointer over events on this visual's children (any level in sub-hierarchy).
Return true
to stop an event from being triggered on the hitting child, false
(default) otherwise.
Name | Type | Description |
---|---|---|
hittingVisual |
Visual | The hitting visual, meaning the visual on which the event applies |
x |
Float | The x coordinate of the event |
y |
Float | The y coordinate of the event |
Returns | Description |
---|---|
Bool | true if the event is intercepted |
computeVisibility(): Void
computeClip(): Void
computeTouchable(): Void
computeRenderTarget(): Void
Metadata
Name | Parameters |
---|---|
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:allow |
ceramic.App |
:allow |
ceramic.Screen |
:allow |
ceramic.MeshPool |