[ view source ]
class ScrollingLayout<T>
package elements
extends ScrollView › View › Layer › Quad › Visual › Entity
@:directlyUsed@:build(tracker.macros.EventsMacro.build())@:autoBuild(tracker.macros.EventsMacro.build())@:build(ceramic.macros.EntityMacro.buildForCompletion())@:autoBuild(ceramic.macros.EntityMacro.buildForCompletion())Available with elements plugin
Constructor
Variables
Inherited Events
Defined by View
@:dox(show)pointerDown(info:TouchInfo):Void
Fired when a pointer (touch or mouse) is down on the visual
Parameters:
info | The info related to this pointer event |
---|
@:dox(show)pointerUp(info:TouchInfo):Void
Fired when a pointer (touch or mouse) was down on the visual and is not anymore
Parameters:
info | The info related to this pointer event |
---|
@:dox(show)pointerOver(info:TouchInfo):Void
Fired when a pointer (touch or mouse) is over the visual
Parameters:
info | The info related to this pointer event |
---|
@:dox(show)pointerOut(info:TouchInfo):Void
Fired when a pointer (touch or mouse) was over the visual and is not anymore
Parameters:
info | The info related to this pointer event |
---|
@:dox(show)collide(visual1:Visual, visual2:Visual):Void
Available with arcade plugin
Dispatched when this visual body collides with another visual's body.
Parameters:
visual1 | This visual |
---|---|
visual2 | The other colliding visual |
@:dox(show)overlap(visual1:Visual, visual2:Visual):Void
Available with arcade plugin
Dispatched when this visual body overlaps with another visual's body.
Parameters:
visual1 | This visual |
---|---|
visual2 | The other overlapping visual |
@:dox(show)collideBody(visual:Visual, body:Body):Void
Available with arcade plugin
Dispatched when this visual body collides with another body.
Parameters:
visual | This visual |
---|---|
body | The other colliding body |
@:dox(show)overlapBody(visual:Visual, body:Body):Void
Available with arcade plugin
Dispatched when this visual body overlaps with another body.
Parameters:
visual | The visual |
---|---|
body | The other overlapping body |
Inherited Variables
Defined by ScrollView
Defined by View
@:value(null)subviews:ReadOnlyArray<View> = null
@:value(-1)computedWidth:Float = -1
Width after being computed by View layout engine from constraints and viewWidth
/viewHeight
@:value(-1)computedHeight:Float = -1
Height after being computed by View layout engine from constraints and viewWidth
/viewHeight
@:value(ViewSize.auto())viewWidth:ViewSize = ViewSize.auto()
Width that will be processed by View layout engine. Can be a numeric value, a percentage (with ViewSize.percent()
), automatic (with ViewSize.fill()
) or undefined (with ViewSize.none()
).
@:value(ViewSize.auto())viewHeight:ViewSize = ViewSize.auto()
Height that will be processed by View layout engine. Can be a numeric value, a percentage (with ViewSize.percent()
), automatic (with ViewSize.fill()
) or undefined (with ViewSize.none()
).
@:value(0)offsetX:Float = 0
Offset this view position by offsetX
.
This offset is added to the view's resulting position
from its default layout. This has only effect when the view is layouted
by a layout class that handle offsets: LinearLayout
, LayersLayout
@:value(0)offsetY:Float = 0
Offset this view position by offsetY
.
This offset is added to the view's resulting position
from its default layout. This has only effect when the view is layouted
by a layout class that handle offsets: LinearLayout
, LayersLayout
@:value(1)flex:Int = 1
A hint to tell how much space this view should take,
* relative to the space taken by a whole group of views.
* Example:
*
* view1.flex = 1; // Fills 1/3 of available space
* view2.flex = 2; // Fills 2/3 of available space
Defined by Quad
@editabletransparent:Bool
If set to true
, this quad will be considered
transparent thus won't be draw on screen.
Children still behave and get drawn as before:
they don't inherit this property.
Defined by Visual
@:value(null)arcade:VisualArcadePhysics = null
Available with arcade plugin
The arcade physics body bound to this visual.
allowRotation:Bool
Available with arcade plugin
Allow this visual to be rotated by arcade physics, via angularVelocity
, etc...
immovable:Bool
Available with arcade plugin
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.
forceX:Bool
Available with arcade plugin
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.
velocityX:Float
Available with arcade plugin
The x velocity, or rate of change the visual position. Measured in points per second.
velocityY:Float
Available with arcade plugin
The y velocity, or rate of change the visual position. Measured in points per second.
accelerationX:Float
Available with arcade plugin
The x acceleration is the rate of change of the x velocity. Measured in points per second squared.
accelerationY:Float
Available with arcade plugin
The y acceleration is the rate of change of the y velocity. Measured in points per second squared.
dragX:Float
Available with arcade plugin
The x drag is the rate of reduction of the x velocity, kind of deceleration. Measured in points per second squared.
dragY:Float
Available with arcade plugin
The y drag is the rate of reduction of the y velocity, kind of deceleration. Measured in points per second squared.
bounceX:Float
Available with arcade plugin
The x elasticity of the visual when colliding. bounceX = 1
means full rebound, bounceX = 0.5
means 50% rebound velocity.
bounceY:Float
Available with arcade plugin
The y elasticity of the visual when colliding. bounceY = 1
means full rebound, bounceY = 0.5
means 50% rebound velocity.
useWorldBounce:Bool
Available with arcade plugin
Enable or disable world bounds specific bounce value with worldBounceX
and worldBounceY
.
Disabled by default, meaning bounceX
and bounceY
are used by default.
worldBounceX:Float
Available with arcade plugin
The x elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceX
used instead).
worldBounceY:Float
Available with arcade plugin
The y elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceY
used instead).
maxDeltaX:Float
Available with arcade plugin
The maximum x delta per frame. 0
(default) means no maximum delta.
maxDeltaY:Float
Available with arcade plugin
The maximum y delta per frame. 0
(default) means no maximum delta.
allowGravity:Bool
Available with arcade plugin
Allow this visual to be influenced by gravity, either world or local.
gravityX:Float
Available with arcade plugin
This visual's local y gravity, added to any world gravity, unless allowGravity
is set to false.
gravityY:Float
Available with arcade plugin
This visual's local x gravity, added to any world gravity, unless allowGravity
is set to false.
frictionX:Float
Available with arcade plugin
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.
frictionY:Float
Available with arcade plugin
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.
angularVelocity:Float
Available with arcade plugin
The angular velocity is the rate of change of the visual's rotation. It is measured in degrees per second.
maxAngularVelocity:Float
Available with arcade plugin
The maximum angular velocity in degrees per second that the visual can reach.
angularAcceleration:Float
Available with arcade plugin
The angular acceleration is the rate of change of the angular velocity. Measured in degrees per second squared.
angularDrag:Float
Available with arcade plugin
The angular drag is the rate of reduction of the angular velocity. Measured in degrees per second squared.
mass:Float
Available with arcade plugin
The mass of the visual's body. When two bodies collide their mass is used in the calculation to determine the exchange of velocity.
read onlyspeed:Float
Available with arcade plugin
The speed of the visual's body (read only). Equal to the magnitude of the velocity.
moves:Bool
Available with arcade plugin
Whether the physics system should update the visual's position and rotation based on its velocity, acceleration, drag, and gravity.
read onlyoverlapX:Float
Available with arcade plugin
When this visual's body collides with another, the amount of overlap (x axis) is stored here.
read onlyoverlapY:Float
Available with arcade plugin
When this visual's body collides with another, the amount of overlap (y axis) is stored here.
read onlyembedded:Bool
Available with arcade plugin
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
.
read onlycollideWorldBounds:Bool
Available with arcade plugin
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.
@:value(false)multiTouch:Bool = false
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.
read onlyisPointerDown:Bool
Whether this visual is between a pointer down
and an pointer up
event or not.
read onlyisPointerOver:Bool
Whether this visual is between a pointer over
and an pointer out
event or not.
@:value(null)clip:Visual = null
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.
@:value(false)inheritAlpha:Bool = false
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.
@:value(true)translatesOnly:Bool = true
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.
@:value(false)translatesOnlyDirty:Bool = false
Whether we should re-check if this visual is only translating or having a more complex transform
@:value(true)contentDirty:Bool = true
Setting this to true will force the visual to recompute its displayed content
@:value(true)matrixDirty:Bool = true
Setting this to true will force the visual's matrix to be re-computed
@:value(true)renderTargetDirty:Bool = true
Setting this to true will force the visual's computed render target to be re-computed
@:value(true)visibilityDirty:Bool = true
Setting this to true will force the visual to compute it's visility in hierarchy
@:value(true)touchableDirty:Bool = true
Setting this to true will force the visual to compute it's touchability in hierarchy
@:value(true)clipDirty:Bool = true
Setting this to true will force the visual to compute it's clipping state in hierarchy
@:value(null)renderTarget:RenderTexture = null
If set, the visual will be rendered into this target RenderTexture instance instead of being drawn onto screen directly.
@:value(true)@editable({ group : "active" })visible:Bool = true
Set to false
to make this visual (and all of its children) invisible and not rendered.
@:value(true)@editable({ group : "active" })touchable:Bool = true
Set to false
to make this visual (and all of its children) not touchable
@:value(0)@editable({ group : "depth" })depth:Float = 0
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.
@:value(1)@editable({ group : "depth", label : "Range" })depthRange:Float = 1
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;
@:value(0)@editable({ group : "position" })x:Float = 0
The x position of this visual. Relative to its parent, or screen if this visual has no parent.
@:value(0)@editable({ group : "position" })y:Float = 0
The y position of this visual. Relative to its parent, or screen if this visual has no parent.
@:value(0)@editable({ group : "anchor" })anchorX:Float = 0
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.
@:value(0)@editable({ group : "anchor" })anchorY:Float = 0
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.
@:value(-1)@editableroundTranslation:Int = -1
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
.
@:value(0)@editable({ slider : [0, 360], degrees : true })rotation:Float = 0
Rotation of the visual in degrees.
The center of the rotation depends on anchorX
and anchorY
.
@:value(1)@editable({ slider : [0, 1] })alpha:Float = 1
Alpha of the visual. Must be a value between 0
(transparent) and 1
(fully opaque)
@editable({ group : "translate" })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.
@editable({ group : "translate" })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.
@:value(null)transform:Transform = null
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).
@:value(null)@editableshader:Shader = null
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.
@:value(true)read onlycomputedVisible:Bool = true
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.
@:value(1)read onlycomputedAlpha:Float = 1
Computed alpha value. This is the combination of this visual's alpha and its parent alpha
if inheritAlpha
is true
@:value(0)read onlycomputedDepth:Float = 0
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.
@:value(null)read onlycomputedRenderTarget:RenderTexture = null
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.
@:value(true)read onlycomputedTouchable:Bool = true
Computed touchable value. This is true
if this visual is touchable
and all
of its parents are touchable
.
@:value(null)read onlycomputedClip:Visual = null
If any parent of this visual has a clip
visual assigned, this will be the computed/resolved visual.
@:value(null)read onlychildren:ReadOnlyArray<Visual> = null
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.
@:value(null)read onlyparent:Visual = null
The parent visual if there is any, or null
if this visual doesn't have any parent.
@:value(null)nape:VisualNapePhysics = null
Available with nape plugin
The nape physics (body) of this visual.
Defined by Entity
@editablecomponents:ReadOnlyMap<String, Component>
Public components mapping. Contain components
created separately with component()
or macro-based components as well.
Inherited Methods
Defined by View
padding(top:Float, ?right:Float, ?bottom:Float, ?left:Float):Void
Set padding. Order and number of parameters following CSS padding convention. Examples:
padding(10) // top=10, right=10, bottom=10, left=10
padding(3, 5) // top=3, right=5, bottom=3, left=5
padding(3, 5, 8, 4) // top=3, right=5, bottom=8, left=4
inlineoffset(x:Float, y:Float):Void
Offset this view position by x
and y
.
This offset is added to the view's resulting position
from its default layout. This has only effect when the view is layouted
by a layout class that handle offsets: LinearLayout
, LayersLayout
inlinepersistComputedSizeWithContext(parentWidth:Float, parentHeight:Float, parentLayoutMask:ViewLayoutMask):Void
inlinehasPersistentComputedSizeWithContext(parentWidth:Float, parentHeight:Float, parentLayoutMask:ViewLayoutMask):Bool
autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun
Creates a new Autorun
instance with the given callback associated with the current entity.
Parameters:
run | The run callback |
---|
Returns:
The autorun instance
@:value({ applyComputedSize : false })inlineautoComputeSize(applyComputedSize:Bool = false):Void
Auto compute size from constraints and viewWidth
/viewHeight
.
Parameters:
applyComputedSize | if |
---|
@:value({ applyComputedSize : false })inlineautoComputeSizeIfNeeded(applyComputedSize:Bool = false):Void
Auto compute size (if needed) from constraints and viewWidth
/viewHeight
.
Parameters:
applyComputedSize | if |
---|
inlineapplyComputedSize():Void
Apply the computed size to the view.
This is equivalent to size(computedWidth, computedHeight)
computeSizeWithIntrinsicBounds(parentWidth:Float, parentHeight:Float, layoutMask:ViewLayoutMask, persist:Bool, intrinsicWidth:Float, intrinsicHeight:Float):Float
Compute size with intrinsic bounds, allowing to scale the bounds to fit current layout constraints. Typically used to compute image size with scale to fit requirements and similar
inlinecomputeSizeIfNeeded(parentWidth:Float, parentHeight:Float, layoutMask:ViewLayoutMask, persist:Bool):Void
@:value({ factor : 1.0 })bindToScreenSize(factor:Float = 1.0):Void
Will set this view size to screen size, and update view size each time screen size changes.
bindToTargetSize():Void
Will set this visual size to target size (settings.targetWidth
and settings.targetHeight
),
and update view size each time it changes.
Defined by Layer
Defined by Quad
Defined by Visual
initArcadePhysics(?world:ArcadeWorld):VisualArcadePhysics
Available with arcade plugin
Init arcade physics (body) bound to this visual.
Parameters:
world | (optional) A world instance where the body will be attached. If none is provided, default world (app.arcade.world) will be used. |
---|
Returns:
A VisualArcadePhysics
instance
inlinevelocity(velocityX:Float, velocityY:Float):Void
Available with arcade plugin
Set velocity, or rate of change of the visual position. Measured in points per second.
Parameters:
velocityX | The velocity on x axis |
---|---|
velocityY | The velocity on y axis |
inlinemaxVelocity(maxVelocityX:Float, maxVelocityY:Float):Void
Available with arcade plugin
Set maximum velocity that the visual can reach.
Parameters:
maxVelocityX | The max velocity on x axis |
---|---|
maxVelocityY | The max velocity on y axis |
inlineacceleration(accelerationX:Float, accelerationY:Float):Void
Available with arcade plugin
Set acceleration, which is the rate of change of the velocity. Measured in points per second squared.
Parameters:
accelerationX | The acceleration on x axis |
---|---|
accelerationY | The acceleration on y axis |
inlinedrag(dragX:Float, dragY:Float):Void
Available with arcade plugin
Set drag, which is the rate of reduction of the velocity, kind of deceleration. Measured in points per second squared.
Parameters:
dragX | The drag value on x axis |
---|---|
dragY | The drag value on y axis |
inlinebounce(bounceX:Float, bounceY:Float):Void
Available with arcade plugin
Set elasticity of the visual when colliding. 1
means full rebound, 0.5
means 50% rebound velocity.
Parameters:
bounceX | The bounce value on x axis |
---|---|
bounceY | The bounce value on y axis |
inlineworldBounce(worldBounceX:Float, worldBounceY:Float):Void
Available with arcade plugin
The elasticity of the visual when colliding with world bounds. Ignored if useWorldBounce
is false
(bounceY
used instead).
Parameters:
worldBounceX | The elasticity value on x axis |
---|---|
worldBounceY | The elasticity value on y axis |
inlinemaxDelta(maxDeltaX:Float, maxDeltaY:Float):Void
Available with arcade plugin
The max delta, or rate of change the visual position. Measured in points per second.
Parameters:
maxDeltaX | The max delta value on x axis |
---|---|
maxDeltaY | The max delta value on y axis |
inlinegravity(gravityX:Float, gravityY:Float):Void
Available with arcade plugin
This visual's local gravity, added to any world gravity, unless allowGravity
is set to false.
Parameters:
gravityX | The gravity on x axis |
---|---|
gravityY | The gravity on y axis |
inlinefriction(frictionX:Float, frictionY:Float):Void
Available with arcade plugin
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.
Parameters:
frictionX | The friction on x axis |
---|---|
frictionY | The friction on y axis |
stop():Void
Stop this visual, whatever that means (override in subclasses). When arcade physics are enabled, visual's body is stopped from this call.
inlineflag(index:Int, ?value:Bool):Bool
Read and write arbitrary boolean flags on this visual. Index should be between 0 (included) and 16 (excluded) or result is undefined.
Parameters:
index | The index of the flag to change, between 0 (included) and 16 (excluded) |
---|---|
value | (optional) The boolean value to set, or no value to simply read current value |
Returns:
The existing value if just reading, or the new value if writing
inlinesize(width:Float, height:Float):Void
Shorthand to set width
and height
in a single call.
Parameters:
width | The width to set to the visual |
---|---|
height | The height to set to the visual |
inlineanchor(anchorX:Float, anchorY:Float):Void
Shorthand to set anchorX
and anchorY
in a single call.
Parameters:
anchorX | The anchor to set to the visual on x axis |
---|---|
anchorY | The anchor to set to the visual on y axis |
inlinepos(x:Float, y:Float):Void
Shorthand to set x
and y
in a single call.
Parameters:
x | The x position to set to the visual |
---|---|
y | The y position to set to the visual |
inlinescale(scaleX:Float):Void
inlinescale(scaleX:Float, scaleY:Float):Void
Shorthand to set scaleX
and scaleY
in a single call.
Parameters:
scaleX | The scale to set to the visual on x axis |
---|---|
scaleY | (optional) The scale to set to the visual on y axis. If not provided, will use scaleX value. |
inlineskew(skewX:Float, skewY:Float):Void
Shorthand to set skewX
and skewY
in a single call.
Parameters:
skewX | The skew to set to the visual on x axis |
---|---|
skewY | The skew to set to the visual on y axis |
inlinetranslate(translateX:Float, translateY:Float):Void
Shorthand to set translateX
and translateY
in a single call.
Parameters:
translateX | The translation to set to the visual on x axis |
---|---|
translateY | The translation to set to the visual on y axis |
anchorKeepPosition(anchorX:Float, anchorY:Float):Void
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.
Parameters:
anchorX | The anchor to set to the visual on x axis |
---|---|
anchorY | The anchor to set to the visual on y axis |
@:value({ recursive : true })childWithId(id:String, recursive:Bool = true):Visual
Returns the first child matching the requested id
or null
otherwise.
Parameters:
id | The requested id |
---|---|
recursive | (optional) Recursive search in children |
Returns:
A matching visual or null
inlinehits(x:Float, y:Float):Bool
inlinehits(x:Float, y:Float, ignoreRenderTarget:Bool):Bool
Returns true if screen (x, y) screen coordinates hit/intersect this visual visible bounds
Parameters:
x | Screen x coordinate |
---|---|
y | Screen y coordinate |
Returns:
true
if it hits
private@:dox(show)hitTest(x:Float, y:Float, matrix:Transform):Bool
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.
Parameters:
x | Screen x coordinate |
---|---|
y | Screen y coordinate |
matrix | The matrix being applied to visual, relative to screen space |
Returns:
true
if it hits
private@:dox(show)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.
Parameters:
hittingVisual | The hitting visual, meaning the visual on which the event applies |
---|---|
x | The x coordinate of the event |
y | The y coordinate of the event |
touchIndex | The touch index of the event (or |
buttonId | The button id of the event (or |
Returns:
true
if the event is intercepted
private@:dox(show)interceptPointerOver(hittingVisual:Visual, x:Float, y:Float):Bool
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.
Parameters:
hittingVisual | The hitting visual, meaning the visual on which the event applies |
---|---|
x | The x coordinate of the event |
y | The y coordinate of the event |
Returns:
true
if the event is intercepted
@:value({ handleFilters : true })screenToVisual(x:Float, y:Float, point:Point, handleFilters:Bool = true):Void
Assign x and y to given point after converting them from screen coordinates to current visual coordinates.
Parameters:
x | The x coordinate |
---|---|
y | The y coordinate |
point | The point in which resulting x and y coordinate are stored |
handleFilters | (optional) Make it |
@:value({ handleFilters : true })visualToScreen(x:Float, y:Float, point:Point, handleFilters:Bool = true):Void
Assign x and y to given point after converting them from current visual coordinates to screen coordinates.
Parameters:
x | The x coordinate |
---|---|
y | The y coordinate |
point | The point in which resulting x and y coordinate are stored |
handleFilters | (optional) Make it |
visualToTransform(transform:Transform):Void
Extract current visual transformation and write it into the given transform
Parameters:
transform | The transform object to write data into |
---|
@:value({ step : 1, start : 1 })autoChildrenDepth(start:Float = 1, step:Float = 1):Void
Will walk on every children and set their depths starting from
start
and incrementing depth by step
.
Parameters:
start | The depth starting value (default 1). First child will have this depth, next child |
---|---|
step | 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.
@:value({ step : 1, start : 1 })normalizeChildrenDepth(start:Float = 1, step:Float = 1):Void
This is the equivalent of calling sortChildrenByDepth()
followed with autoChildrenDepth()
Parameters:
start | The depth starting value (default 1). First child will have this depth, next child |
---|---|
step | The depth step to use when increment depth for each child |
hasIndirectParent(targetParent:Visual):Bool
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...
Parameters:
targetParent | The target parent to check |
---|
Returns:
true
if the visual has the given target parent as indirect parent
firstParentWithClass<T>(clazz:Class<T>):T
Returns the first parent (can be indirect) of this visual that matches
the given class or null
if none is matching
Parameters:
clazz | The requested class |
---|
Returns:
A matching parent or null
@:value({ recursive : false })contains(child:Visual, recursive:Bool = false):Bool
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.
Parameters:
child | The child to check in hierarchy |
---|---|
recursive | (optional) Set to |
Returns:
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.
initNapePhysics(type:NapePhysicsBodyType, ?space:Space, ?shape:Shape, ?shapes:Array<Shape>, ?material:Material):VisualNapePhysics
Available with nape plugin
Init nape physics body bound to this visual.
Parameters:
type | Physics body type ( |
---|---|
space | (optional) Related nape spaces. Will use default space if not provided. |
shape | (optional) Shape used for this body. Default is a box matching visual bounds. |
shapes | (optional) Array of shapes used for this body. |
material | (optional) A custom material to use with this body. |
Returns:
A VisualNapePhysics
instance