Stage class
The Stage is the root display container for a GraphX scene. It extends the GDisplayObjectContainer class and provides a canvas to which you can draw objects, as well as handling resize and tick events.
The Stage has a ScenePainter that defines the scene's SceneController. It is responsible for updating the scene and painting the display tree. It also mixes in various signal mix-ins to enable the dispatching of resize, tick and mouse input events to the scene and display tree.
The Stage has a size (stageWidth and stageHeight) that can be set by the parent container.
The Stage class overrides the hitTest method to ensure that mouse events are only dispatched to visible and mouse-enabled objects within the stage's bounds.
The Stage class provides the mouseX and mouseY properties to get the current mouse position within the stage's bounds. It also overrides various properties and methods from GDisplayObject that are not applicable to the stage, such as width, height, x, y, scaleX, scaleY, pivotX, pivotY, skewX, skewY, and rotation.
- Inheritance
- Mixed in types
- Available Extensions
Constructors
- Stage(ScenePainter scene)
- Initializes a new instance of the Stage class. Should only be initialized by the ScenePainter.
Properties
- $alpha ↔ double
-
(Internal usage)
The alpha (transparency) value of this object,
a value between 0.0 (fully transparent) and 1.0 (fully opaque).
getter/setter pairinherited
- $colorize ↔ Color?
-
(Internal usage)
The color to apply to this object.
getter/setter pairinherited
- $debugBounds ↔ bool
-
(Internal usage)
Whether to show debug bounds for this object.
getter/setter pairinherited
- $debugBoundsPaint ↔ Paint?
-
(Internal usage)
Defines the debug paint used to show the bounds of this display object
when debug mode is enabled. By default, it uses a magenta stroke with
a width of 1. Override this property to use a custom debug paint.
getter/setter pairinherited
- $debugLastLayerBounds ↔ GRect?
-
(Internal usage)
Tracks the last layer bounds used for rendering this display object
using getBounds($parent).
getter/setter pairinherited
-
$filters
↔ List<
GBaseFilter> ? -
(Internal usage)
The filters applied to this object.
getter/setter pairinherited
- $hasColorize → bool
-
(Internal usage)
Whether this object has a color applied to it.
no setterinherited
- $hasTouchableArea ↔ bool
-
(Internal usage)
Optimization flag indicating whether this object has a touchable area.
getter/setter pairinherited
- $hasVisibleArea ↔ bool
-
(Internal usage)
Optimization flag indicating whether this object has a visible area.
getter/setter pairinherited
- $lastClickTime ↔ double
-
(Internal usage)
The time of the last mouse click.
getter/setter pairinherited
- $mask ↔ GShape?
-
(Internal usage)
The mask of this object, used for masking.
getter/setter pairinherited
- $maskee ↔ GDisplayObject?
-
(Internal usage)
The display object that acts as a mask of this object.
getter/setter pairinherited
- $matrixDirty ↔ bool
-
(Internal usage)
Indicates whether the matrix of this object needs to be recalculated.
getter/setter pairinherited
- $mouseDownObj ↔ GDisplayObject?
-
(Internal usage)
The object that the mouse was last pressed on.
getter/setter pairinherited
- $mouseOverObj ↔ GDisplayObject?
-
(Internal usage)
The object that the mouse is currently over.
getter/setter pairinherited
- $onAdded ↔ Signal?
-
(Internal)
getter/setter pairinherited
- $onAddedToStage ↔ Signal?
-
(Internal)
getter/setter pairinherited
-
$onEnterFrame
↔ EventSignal<
double> ? -
(Internal)
getter/setter pairinherited
-
$onMouseClick
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseDoubleClick
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseDown
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseEnter
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseLeave
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseMove
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseOut
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseOver
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseUp
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onMouseWheel
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onPostPaint
↔ EventSignal<
Canvas> ? -
(Internal)
getter/setter pairinherited
-
$onPrePaint
↔ EventSignal<
Canvas> ? -
(Internal)
getter/setter pairinherited
-
$onPreTransform
↔ EventSignal<
Canvas> ? -
(Internal)
getter/setter pairinherited
- $onRemoved ↔ Signal?
-
(Internal)
getter/setter pairinherited
- $onRemovedFromStage ↔ Signal?
-
(Internal)
getter/setter pairinherited
- $onResized ↔ Signal?
-
(Internal)
getter/setter pairinherited
-
$onRightMouseDown
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
-
$onZoomPan
↔ EventSignal<
MouseInputData> ? -
(Internal)
getter/setter pairinherited
- $parent ↔ GDisplayObjectContainer?
-
(Internal usage)
The parent display object container that this object is a child of.
getter/setter pairinherited
- $useSaveLayerBounds ↔ bool
-
(Internal usage)
When enabled, a rectangle is created to save the layer for better
rendering performance.
getter/setter pairinherited
- allowSaveLayer ↔ bool
-
When enabled, the saveLayer() feature is used for better rendering
performance. Disabling it may provide better performance for certain
display objects.
Childless DisplayObjects, like GShape and GBitmap, have their own
Paint() so no need to use an expensive saveLayer().
getter/setter pairinherited
- alpha ↔ double
-
Returns the alpha (transparency) value of this object.
getter/setter pairinherited
- base → GDisplayObject
-
Returns the base object, i.e. the topmost parent in the display hierarchy.
no setterinherited
- bounds → GRect?
-
TODO: should be cached.
Returns the bounds of this object in its local coordinate space.
no setterinherited
-
children
→ List<
GDisplayObject> -
The list of children that this container holds.
finalinherited
- color ↔ Color?
-
Gets the background color of the stage.
getter/setter pair
- colorize ↔ Color?
-
Gets the color applied to this object.
getter/setter pairinherited
- controller → SceneController
-
Gets the owner SceneController for the stage.
no setter
- filterPaint ↔ Paint
-
The paint to use for filters that require a paint.
getter/setter pairinherited
-
filters
↔ List<
GBaseFilter> ? -
Gets the filters applied to this object.
getter/setter pairinherited
- hasChildren → bool
-
Whether this container has any children.
no setterinherited
- hasFilters → bool
-
Returns true if this object has any filters applied.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
Indicates the height of the display object, in dp.
The
height
is calculated based on the bounds of the content of the display object. When you set theheight
property, thescaleX
property is adjusted accordingly, as shown in the following code:getter/setter pairoverride - inStage → bool
-
Returns
true
if this object is on the stage.no setterinherited - isMask → bool
-
Returns whether this object is currently being used as a mask for another
object.
no setterinherited
- isMouseInside → bool
-
Returns a boolean indicating whether the mouse pointer is inside the stage.
So if it's available to detect events.
no setter
- isRotated → bool
-
Returns whether this object has any rotation or skew transformation.
no setterinherited
-
keyboard
→ KeyboardManager<
KeyboardEventData> ? -
Access the keyboard instance of the owner
SceneController
, Only available when SceneConfig.useKeyboard is true.no setter - mask ↔ GShape?
-
Returns the mask of this object.
getter/setter pairinherited
- maskBounds ↔ bool
-
The native canvas bounds will be clipped to the bounds of the stage if
maskBounds is set to
true
.getter/setter pair - maskInverted ↔ bool
-
Whether the object should apply an inverted mask.
can be set on the Shape mask, or the maskee DisplayObject.
getter/setter pairinherited
- maskRect ↔ GRect?
-
The rectangular area of the mask.
getter/setter pairinherited
- maskRectCornerRadius ↔ double?
-
The corner radius of the mask.
getter/setter pairinherited
- maskRectInverted ↔ bool
-
Whether the mask is inverted or not.
getter/setter pairinherited
- mouseChildren ↔ bool
-
Whether this container will capture mouse input events for its children.
getter/setter pairinherited
- mouseEnabled ↔ bool
-
Indicates whether this object can receive mouse and touch input events.
getter/setter pairinherited
- mouseEnableStillEvents ↔ bool
-
If set to
true
, mouse events will be dispatched to objects that are not directly below the mouse pointer but still receive mouse events (like mouse move events).getter/setter pair - mousePosition → GPoint
-
Returns the position of the mouse in the local coordinate system of this
object.
The mouse position is updated every frame, so this method returns the
current mouse position relative to the top-left corner of this object.
no setterinherited
- mouseUseShape ↔ bool
-
Whether to use the shape of the object for mouse event detection.
getter/setter pairinherited
- mouseX → double
-
Returns the current x-coordinate of the mouse pointer on the stage.
no setteroverride
- mouseY → double
-
Returns the current y-coordinate of the mouse pointer on the stage.
no setteroverride
- name ↔ String?
-
Name to reference this object.
getter/setter pairinherited
- numChildren → int
-
The number of children of this container.
no setterinherited
- onAdded → Signal
-
Returns the Signal that is triggered when an object is added to the
display list.
no setterinherited
- onAddedToStage → Signal
-
Returns the Signal that is triggered when an object is added to the
stage.
no setterinherited
-
onEnterFrame
→ EventSignal<
double> -
Returns the EventSignal that is triggered on every frame update.
no setterinherited
- onHotReload → Signal
-
A signal that is dispatched when the scene is reloaded (for hot-reloading
purposes).
no setter
-
onMouseClick
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse is clicked.
no setterinherited
-
onMouseDoubleClick
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse is double clicked.
no setterinherited
-
onMouseDown
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse button is pressed down.
no setterinherited
-
onMouseEnter
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse enters the stage.
no setterinherited
-
onMouseLeave
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse leaves the stage.
no setterinherited
-
onMouseMove
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse is moved.
no setterinherited
-
onMouseOut
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse leaves a component.
no setterinherited
-
onMouseOver
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse is over a component.
no setterinherited
-
onMouseScroll
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse wheel is scrolled.
no setterinherited
-
onMouseUp
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the mouse button is released.
no setterinherited
-
onPostPaint
→ EventSignal<
Canvas> -
A signal that runs right after GDisplayObject.$applyPaint is called.
no setterinherited
-
onPrePaint
→ EventSignal<
Canvas> -
A signal that runs before GDisplayObject.$applyPaint, which is the
render method to subclass.
no setterinherited
-
onPreTransform
→ EventSignal<
Canvas> -
A signal that runs right away when GDisplayObject.paint is called,
before any mask or filters are applied. This is the first signal to run
on rendering.
no setterinherited
- onRemoved → Signal
-
Returns the Signal that is triggered when an object is removed from the
display list.
no setterinherited
- onRemovedFromStage → Signal
-
Returns the Signal that is triggered when an object is removed from the
stage.
no setterinherited
- onResized → Signal
-
Returns the Signal that is triggered when the size of an object changes.
no setterinherited
-
onRightMouseDown
→ EventSignal<
MouseInputData> -
A signal that is dispatched when the right mouse button is pressed down.
no setterinherited
-
onZoomPan
→ EventSignal<
MouseInputData> -
A signal that is dispatched when a zoom/pan gesture is performed.
no setterinherited
- parent → GDisplayObjectContainer?
-
Returns the parent container.
no setterinherited
- pivotX ↔ double
-
Returns the x coordinate of the pivot point,
the center of scaling and rotation.
getter/setter pairinherited-getteroverride-setter
- pivotY ↔ double
-
Returns the y coordinate of the pivot point,
the center of scaling and rotation.
getter/setter pairinherited-getteroverride-setter
-
pointer
→ PointerManager<
PointerEventData> ? -
Access the pointer (mouse or touch info) instance of the
owner
SceneController
, Only available when SceneConfig.usePointer is true.no setter - root → GDisplayObject?
-
Returns the root
GDisplayObject
that is the ancestor of this object (either aStage
or anull
).no setterinherited - rotation ↔ double
-
Returns the angle of rotation in radians.
getter/setter pairinherited-getteroverride-setter
- rotationX ↔ double
-
The rotation angle in radians about the x-axis for 3d transformation.
getter/setter pairinherited
- rotationY ↔ double
-
The rotation angle in radians about the y-axis for 3d transformation.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale ↔ double
-
Shortcut for setting proportional X and Y scale values.
getter/setter pairinherited
- scaleX ↔ double
-
Returns the horizontal scale of the object.
getter/setter pairinherited-getteroverride-setter
- scaleY ↔ double
-
Returns the vertical scale of the object.
getter/setter pairinherited-getteroverride-setter
- scene → ScenePainter
-
The scene painter that defines the scene's SceneController.
final
- showBoundsRect ↔ bool
-
Determines whether to display the bounds of the stage area
drawing a 2px black line square around it.
Useful to debug if the mouse touches are not working because the widget
is not covering the whole screen.
getter/setter pair
- skewX ↔ double
-
Returns the angle of skew on the x-axis in radians.
getter/setter pairinherited-getteroverride-setter
- skewY ↔ double
-
Returns the angle of skew on the y-axis in radians.
getter/setter pairinherited-getteroverride-setter
- stage → Stage?
-
Returns the stage this object is on or
null
if it's not on a stage.no setterinherited - stageHeight → double
-
The current height of the Stage.
no setter
- stageRect → GRect
-
Returns the bounds of the stage as a GRect.
no setter
- stageWidth → double
-
The current width of the Stage.
no setter
- transformationMatrix ↔ GMatrix
-
Gets the transformation matrix that represents the object's position,
scale, rotation and skew.
getter/setter pairinherited
- useCursor ↔ bool
-
Whether to use a custom cursor for this object.
getter/setter pairinherited
- userData ↔ Object?
-
You can store any user defined data in this property for easy access.
getter/setter pairinherited
- visible ↔ bool
-
Returns whether the display object is visible or not.
getter/setter pairinherited
- width ↔ double
-
Indicates the width of the display object, in dp.
The
width
is calculated based on the bounds of the content of the display object. When you set thewidth
property, thescaleX
property is adjusted accordingly, as shown in the following code:getter/setter pairoverride - worldAlpha → double
-
Returns the alpha value of the object relative to its parent and all its
ancestors.
no setterinherited
- worldScaleX → double
-
Returns the horizontal scaling factor of the object relative to its
parent and all its ancestors.
no setterinherited
- worldScaleY → double
-
Returns the vertical scaling factor of the object relative to its parent
and all its ancestors.
no setterinherited
- worldX → double
-
Returns the x coordinate of the object relative to the stage and all its
ancestors.
no setterinherited
- worldY → double
-
Returns the y coordinate of the object relative to the stage and all its
ancestors.
no setterinherited
- x ↔ double
-
The x coordinate of the display object relative to its parent's
coordinate system.
getter/setter pairinherited-getteroverride-setter
- y ↔ double
-
The y coordinate of the display object relative to its parent's
coordinate system.
getter/setter pairinherited-getteroverride-setter
- z ↔ double
-
(Experimental)
The z-coordinate of this object in 3D space.
getter/setter pairinherited
Methods
-
$applyMaskRect(
Canvas? canvas) → void -
Applies the current mask to the provided Canvas.
inherited
-
$applyPaint(
Canvas canvas) → void -
(Internal usage)
Applies the container's paint to the specified
canvas
.inherited -
$dispatchMouseCallback(
MouseInputType type, GDisplayObject object, MouseInputData input) → void -
(Internal usage)
Dispatches a mouse event to the appropriate callback functions.
inherited
-
$disposeDisplayListSignals(
) → void -
Removes all registered listeners and frees all display list signals.
inherited
-
$disposePointerSignals(
) → void -
Disposes all mouse signals to free up memory.
inherited
-
$disposeRenderSignals(
) → void -
Disposes all render-related signals and clears all callbacks for this
instance. This method should be called when the instance is no longer
needed, to prevent memory leaks.
inherited
-
$disposeResizeSignals(
) → void -
(Internal)
Removes all registered listeners and frees the onResized signal.
inherited
-
$disposeStagePointerSignals(
) → void -
Disposes all stage mouse signals to free up memory.
inherited
-
$disposeTickerSignals(
) → void -
(Internal)
Removes all registered listeners and frees the onEnterFrame signal.
inherited
-
$initFrameSize(
Size value) → void - (Internal usage) Initializes the size of the stage.
-
$setParent(
GDisplayObjectContainer? value) → void -
(Internal usage)
Sets the GDisplayObjectContainer that contains this GDisplayObject.
inherited
-
$setTransformationChanged(
) → void -
(Internal usage)
Sets the transformationChanged flag and updates the 3D flag based on
whether the object has 3D properties set.
inherited
-
$tick(
double delta) → void -
TODO: need to find a way to reference the window.
(Internal usage)
Updates the Stage object and dispatches the
enterFrame
event with thedelta
time since the last frame, in seconds. -
$updateTransformationMatrices(
double? x, double? y, double pivotX, double pivotY, double scaleX, double scaleY, double skewX, double skewY, double rotation, GMatrix out) → void -
(Internal usage)
Updates the transformation matrices of a display object based on the given
parameters.
inherited
-
addChild<
T extends GDisplayObject> (T child) → T -
Adds a child to the end of the list of children of this container.
inherited
-
addChildAt<
T extends GDisplayObject> (T child, int index) → T -
Adds a child to the list of children of this container at a specific
index.
inherited
-
addedToStage(
) → void -
Called when the object is added to the stage.
Should be overridden by subclasses as entry point.
inherited
-
alignPivot(
[Alignment alignment = painting.Alignment.center]) → void -
Adjusts the pivot point of this display object to a new location defined
by the given
alignment
parameter, which defaults to Alignment.center. This method calculates the bounds of the object and aligns the pivot point based on the provided alignment parameter. The alignment is represented by an Alignment object, where the x and y values range from -1.0 to 1.0. For example, an Alignment of (-1.0, -1.0) represents the top left corner, while an Alignment of (1.0, 1.0) represents the bottom right corner. The pivot point represents the center point for rotations and scaling, and by default it is set to (0,0), which means that the object is rotated and scaled around the top-left corner. This method is useful to adjust the pivot point to a more suitable location before performing rotations or scaling operations. If the bounds of the object are empty, no adjustment is made to the pivot point. The resulting pivot point is stored in the pivotX and pivotY properties of this display object.inherited -
captureMouseInput(
MouseInputData input) → void -
Captures the MouseInputData and processes it to update mouse input state
and dispatch MouseEvent signals on this Stage or its children.
override
-
contains(
GDisplayObject? child, [bool recursive = true]) → bool -
Returns true if a given
child
is a descendant of this container, or false otherwise.inherited -
createImage(
[bool adjustOffset = true, double resolution = 1, GRect? rect]) → Future< Image> -
Creates an image representation of the current state of the
GDisplayObject.
If
adjustOffset
is true, the resulting image will be offset so that its top-left corner corresponds to the top-left corner of the current bounds. Ifresolution
is provided and is different than 1, the image will be scaled by this factor before being returned. Ifrect
is provided, it defines a rectangle that will be used as the bounds for the image instead of the getFilterBounds of the GDisplayObject. Returns a Future that resolves to a ui.Image representing the current state of the GDisplayObject in the form of an image.inherited -
createImageSync(
[bool adjustOffset = true, double resolution = 1, GRect? rect]) → Image -
Creates a synchronous image from this display object.
inherited
-
createImageTexture(
[bool adjustOffset = true, double resolution = 1, GRect? rect]) → Future< GTexture> -
Creates a new
GTexture
asynchronously from the display object's image. The image is retrieved using the createImage method, and a new texture is created from the image with the specified resolution. If arect
is specified, only the portion of the image within the bounds of the rectangle will be used to create the texture. IfadjustOffset
is true, the image will be adjusted to remove any offsets from the top left corner.inherited -
createImageTextureSync(
[bool adjustOffset = true, double resolution = 1, GRect? rect]) → GTexture -
Creates a texture from the synchronous image generated from this display
object.
inherited
-
createPicture(
[void prePaintCallback(Canvas)?, void postPaintCallback(Canvas)?]) → Picture -
Creates a picture of the current state of the DisplayObject.
To ensure the "original" form, call before applying any transformations
(x, y, scale, etc).
inherited
-
dispose(
) → void -
Disposes the Stage object, releasing any resources used by it and
removing it from the display list.
override
-
getBounds(
GDisplayObject? targetSpace, [GRect? out]) → GRect? -
Returns the bounds of this container in the given
targetSpace
.inherited -
getChildAt<
T extends GDisplayObject> (int index) → T -
Returns the child at a specific index in the list of children of this
container.
inherited
-
getChildByName<
T extends GDisplayObject> (String name) → T? -
Returns the child object that exists with the specified
name
.inherited -
getChildIndex(
GDisplayObject child) → int -
Returns the index of a child in the list of children of this container,
or -1 if the child is not found.
inherited
-
getFilterBounds(
[GRect? layerBounds, Paint? alphaPaint]) → GRect? -
Returns the bounds of this object after applying all its filters.
inherited
-
getObjectsUnderPoint(
GPoint localPoint) → List< GDisplayObject> -
Returns a list of display objects that are under the specified
localPoint
.inherited -
getStageBounds(
GDisplayObject targetSpace, [GRect? out]) → GRect -
Returns the bounds of the Stage object in the coordinate system
specified by the
targetSpace
object. If theout
parameter is provided, the result is stored in that object. Otherwise, a new GRect object is created and returned. -
getTransformationMatrix(
GDisplayObject? targetSpace, [GMatrix? out]) → GMatrix -
Returns the transformation matrix that transforms coordinates from the
local coordinate system to the coordinate system of the targetSpace.
inherited
-
globalToLocal(
GPoint globalPoint, [GPoint? out]) → GPoint -
Converts the given point from global coordinates to local coordinates.
inherited
-
hitTest(
GPoint localPoint, [bool useShape = false]) → GDisplayObject? -
Returns the deepest GDisplayObject that lies under the given point.
override
-
hitTestMask(
GPoint localPoint) → bool -
Determines whether the
localPoint
specified in the local coordinates of this object lies inside its mask.inherited -
hitTouch(
GPoint localPoint, [bool useShape = false]) → bool -
Checks whether a
localPoint
inside the object's boundary. This method always returnstrue
for theStage
object, because it occupies the entire screen and it should always receive touch events.override -
localToGlobal(
GPoint localPoint, [GPoint? out]) → GPoint -
Transforms the given
localPoint
from the local coordinate system to the global coordinate system.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
Canvas canvas) → void -
Renders this stage on the given canvas.
override
-
removeChild<
T extends GDisplayObject> (T child, [bool dispose = false]) → T? -
Removes the specified child from this container.
inherited
-
removeChildAt<
T extends GDisplayObject> (int index, [bool dispose = false]) → T -
Removes the child at the specified index from this container.
inherited
-
removeChildren(
[int fromIndex = 0, int endIndex = -1, bool dispose = false]) → void -
Removes a child from the list of children of this container based on its
index.
inherited
-
removedFromStage(
) → void -
Called when the object is removed to the stage.
inherited
-
removeFromParent(
[bool dispose = false]) → void -
Removes this GDisplayObject from its parent GDisplayObjectContainer.
inherited
-
requiresRedraw(
) → void -
Notifies the parent that the current state of this
GDisplayObject
has changed and it requires a redraw.inherited -
setChildIndex(
GDisplayObject child, int index) → void -
Sets the index of a child in the list of children of this container.
inherited
-
setPosition(
double x, double y) → GDisplayObject -
Sets the
x
andy
transformation of the DisplayObject and returns it.inherited -
setScale(
double scaleX, [double? scaleY]) → GDisplayObject -
Sets the
scaleX
andscaleY
transformation of the DisplayObject and returns it. If only one argument is provided, bothscaleX
andscaleY
are set to the same value.inherited -
sortChildren(
SortChildrenCallback compare) → void -
Sorts the list of children of this container using a custom comparison
function.
inherited
-
startDrag(
[bool lockCenter = false, GRect? bounds]) → void -
Makes this object draggable. When this object is dragged, its x and y
properties will be updated to match the mouse position.
The
lockCenter
parameter, if set to true, will cause the object to be dragged from its center point. Thebounds
parameter can be used to restrict the movement of the object to a certain area. Throws an error if the object is not visible or touchable.inherited -
stopDrag(
) → void -
Stops the current drag operation, if this DisplayObject is currently being
dragged. Removes the mouse move event listener and sets the current drag
object to null. Does nothing if this DisplayObject is not currently being
dragged.
inherited
-
swapChildren(
GDisplayObject child1, GDisplayObject child2) → void -
Swaps the positions of two children.
Throws an ArgumentError if
child1
orchild2
are not children of this container. Ifchild1
andchild2
are the same object, nothing happens.inherited -
swapChildrenAt(
int index1, int index2) → void -
Swaps the two children objects at the specified indexes.
inherited
-
toString(
) → String -
Returns a string representation of this instance.
override
-
update(
double delta) → void -
Updates all children of this container.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited