Class: HTMLDisplayObject<T>

html.HTMLDisplayObject

A wrapper class for copying PIXI.DisplayObject transforms to HTMLElement CSS style.

Type parameters

Name Type
T extends HTMLElement = HTMLElement

Hierarchy

  • DisplayObject

    HTMLDisplayObject

Constructors

constructor

new HTMLDisplayObject<T>(htmlElement): HTMLDisplayObject<T>

Type parameters

Name Type
T extends HTMLElement = HTMLElement

Parameters

Name Type
htmlElement T

Returns

HTMLDisplayObject<T>

Overrides

PIXIDisplay.DisplayObject.constructor

Properties

_accessibleActive

Optional _accessibleActive: boolean

Inherited from

PIXIDisplay.DisplayObject._accessibleActive


_accessibleDiv

Optional _accessibleDiv: IAccessibleHTMLElement

Inherited from

PIXIDisplay.DisplayObject._accessibleDiv


_bounds

_bounds: Bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

Inherited from

PIXIDisplay.DisplayObject._bounds


_boundsID

Protected _boundsID: number

Flags the cached bounds as dirty.

Inherited from

PIXIDisplay.DisplayObject._boundsID


_boundsRect

Protected _boundsRect: Rectangle

Cache of this display-object’s bounds-rectangle.

Inherited from

PIXIDisplay.DisplayObject._boundsRect


_cacheAsBitmap

_cacheAsBitmap: boolean

Inherited from

PIXIDisplay.DisplayObject._cacheAsBitmap


_cacheAsBitmapMultisample

_cacheAsBitmapMultisample: MSAA_QUALITY

Inherited from

PIXIDisplay.DisplayObject._cacheAsBitmapMultisample


_cacheAsBitmapResolution

_cacheAsBitmapResolution: number

Inherited from

PIXIDisplay.DisplayObject._cacheAsBitmapResolution


_cacheData

_cacheData: CacheData

Inherited from

PIXIDisplay.DisplayObject._cacheData


_destroyed

Protected _destroyed: boolean

If the object has been destroyed via destroy(). If true, it should not be used.

Inherited from

PIXIDisplay.DisplayObject._destroyed


_enabledFilters

Protected _enabledFilters: Filter[]

Currently enabled filters.

Inherited from

PIXIDisplay.DisplayObject._enabledFilters


_internalEventMode

_internalEventMode: EventMode

Inherited from

PIXIDisplay.DisplayObject._internalEventMode


_internalInteractive

_internalInteractive: boolean

Inherited from

PIXIDisplay.DisplayObject._internalInteractive


_lastSortedIndex

Protected _lastSortedIndex: number

Which index in the children array the display component was before the previous zIndex sort. Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.

Inherited from

PIXIDisplay.DisplayObject._lastSortedIndex


_localBounds

_localBounds: Bounds

Local bounds object, swapped with _bounds when using getLocalBounds().

Inherited from

PIXIDisplay.DisplayObject._localBounds


_localBoundsRect

Protected _localBoundsRect: Rectangle

Cache of this display-object’s local-bounds rectangle.

Inherited from

PIXIDisplay.DisplayObject._localBoundsRect


_mask

Protected _mask: MaskData | Container<DisplayObject>

The original, cached mask of the object.

Inherited from

PIXIDisplay.DisplayObject._mask


_zIndex

Protected _zIndex: number

The zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.

Inherited from

PIXIDisplay.DisplayObject._zIndex


accessible

Optional accessible: boolean

Inherited from

PIXIDisplay.DisplayObject.accessible


accessibleChildren

Optional accessibleChildren: boolean

Inherited from

PIXIDisplay.DisplayObject.accessibleChildren


accessibleHint

Optional accessibleHint: string

Inherited from

PIXIDisplay.DisplayObject.accessibleHint


accessiblePointerEvents

Optional accessiblePointerEvents: PointerEvents

Inherited from

PIXIDisplay.DisplayObject.accessiblePointerEvents


accessibleTitle

Optional accessibleTitle: string

Inherited from

PIXIDisplay.DisplayObject.accessibleTitle


accessibleType

Optional accessibleType: string

Inherited from

PIXIDisplay.DisplayObject.accessibleType


alpha

alpha: number

The opacity of the object.

Inherited from

PIXIDisplay.DisplayObject.alpha


cacheAsBitmap

cacheAsBitmap: boolean

Inherited from

PIXIDisplay.DisplayObject.cacheAsBitmap


cacheAsBitmapMultisample

cacheAsBitmapMultisample: MSAA_QUALITY

Inherited from

PIXIDisplay.DisplayObject.cacheAsBitmapMultisample


cacheAsBitmapResolution

cacheAsBitmapResolution: number

Inherited from

PIXIDisplay.DisplayObject.cacheAsBitmapResolution


children

Optional Readonly children: readonly FederatedEventTarget[]

The children of this event target.

Inherited from

PIXIDisplay.DisplayObject.children


cullArea

cullArea: Rectangle

If set, this shape is used for culling instead of the bounds of this object. It can improve the culling performance of objects with many children. The culling area is defined in local space.

Inherited from

PIXIDisplay.DisplayObject.cullArea


cullable

cullable: boolean

Should this object be rendered if the bounds of this object are out of frame?

Culling has no effect on whether updateTransform is called.

Inherited from

PIXIDisplay.DisplayObject.cullable


cursor

cursor: string

The cursor preferred when the mouse pointer is hovering over.

Inherited from

PIXIDisplay.DisplayObject.cursor


displayObjectUpdateTransform

displayObjectUpdateTransform: () => void

Type declaration

▸ (): void

Returns

void

Inherited from

PIXIDisplay.DisplayObject.displayObjectUpdateTransform


eventMode

eventMode: EventMode

The mode of interaction for this object

Inherited from

PIXIDisplay.DisplayObject.eventMode


filterArea

filterArea: Rectangle

The area the filter is applied to. This is used as more of an optimization rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.

Also works as an interaction mask.

Inherited from

PIXIDisplay.DisplayObject.filterArea


filters

filters: null | Filter[]

Sets the filters for the displayObject. IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. To remove filters simply set this property to 'null'.

Inherited from

PIXIDisplay.DisplayObject.filters


hitArea

hitArea: null | IHitArea

The hit-area specifies the area for which pointer events should be captured by this event target.

Inherited from

PIXIDisplay.DisplayObject.hitArea


htmlElement

Readonly htmlElement: T


interactive

interactive: boolean

Whether this event target should fire UI events.

Inherited from

PIXIDisplay.DisplayObject.interactive


interactiveChildren

interactiveChildren: boolean

Whether this event target has any children that need UI events. This can be used optimize event propagation.

Inherited from

PIXIDisplay.DisplayObject.interactiveChildren


isInteractive

isInteractive: () => boolean

Returns true if the DisplayObject has interactive ‘static’ or ‘dynamic’

Type declaration

▸ (): boolean

Returns

boolean

Inherited from

PIXIDisplay.DisplayObject.isInteractive


isMask

isMask: boolean

Does any other displayObject use this object as a mask?

Inherited from

PIXIDisplay.DisplayObject.isMask


isSprite

isSprite: boolean

Used to fast check if a sprite is.. a sprite!

Inherited from

PIXIDisplay.DisplayObject.isSprite


onclick

onclick: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘click’ event

Inherited from

PIXIDisplay.DisplayObject.onclick


onglobalmousemove

onglobalmousemove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘globalmousemove’ event

Inherited from

PIXIDisplay.DisplayObject.onglobalmousemove


onglobalpointermove

onglobalpointermove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘globalpointermove’ event

Inherited from

PIXIDisplay.DisplayObject.onglobalpointermove


onglobaltouchmove

onglobaltouchmove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘globaltouchmove’ event

Inherited from

PIXIDisplay.DisplayObject.onglobaltouchmove


onmousedown

onmousedown: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mousedown’ event

Inherited from

PIXIDisplay.DisplayObject.onmousedown


onmouseenter

onmouseenter: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseenter’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseenter


onmouseleave

onmouseleave: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseleave’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseleave


onmousemove

onmousemove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mousemove’ event

Inherited from

PIXIDisplay.DisplayObject.onmousemove


onmouseout

onmouseout: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseout’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseout


onmouseover

onmouseover: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseover’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseover


onmouseup

onmouseup: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseup’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseup


onmouseupoutside

onmouseupoutside: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘mouseupoutside’ event

Inherited from

PIXIDisplay.DisplayObject.onmouseupoutside


onpointercancel

onpointercancel: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointercancel’ event

Inherited from

PIXIDisplay.DisplayObject.onpointercancel


onpointerdown

onpointerdown: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerdown’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerdown


onpointerenter

onpointerenter: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerenter’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerenter


onpointerleave

onpointerleave: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerleave’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerleave


onpointermove

onpointermove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointermove’ event

Inherited from

PIXIDisplay.DisplayObject.onpointermove


onpointerout

onpointerout: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerout’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerout


onpointerover

onpointerover: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerover’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerover


onpointertap

onpointertap: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointertap’ event

Inherited from

PIXIDisplay.DisplayObject.onpointertap


onpointerup

onpointerup: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerup’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerup


onpointerupoutside

onpointerupoutside: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘pointerupoutside’ event

Inherited from

PIXIDisplay.DisplayObject.onpointerupoutside


onrightclick

onrightclick: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘rightclick’ event

Inherited from

PIXIDisplay.DisplayObject.onrightclick


onrightdown

onrightdown: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘rightdown’ event

Inherited from

PIXIDisplay.DisplayObject.onrightdown


onrightup

onrightup: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘rightup’ event

Inherited from

PIXIDisplay.DisplayObject.onrightup


onrightupoutside

onrightupoutside: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ‘rightupoutside’ event

Inherited from

PIXIDisplay.DisplayObject.onrightupoutside


ontap

ontap: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’tap’ event

Inherited from

PIXIDisplay.DisplayObject.ontap


ontouchcancel

ontouchcancel: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’touchcancel’ event

Inherited from

PIXIDisplay.DisplayObject.ontouchcancel


ontouchend

ontouchend: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’touchend’ event

Inherited from

PIXIDisplay.DisplayObject.ontouchend


ontouchendoutside

ontouchendoutside: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’touchendoutside’ event

Inherited from

PIXIDisplay.DisplayObject.ontouchendoutside


ontouchmove

ontouchmove: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’touchmove’ event

Inherited from

PIXIDisplay.DisplayObject.ontouchmove


ontouchstart

ontouchstart: null | FederatedEventHandler<FederatedPointerEvent>

Handler for ’touchstart’ event

Inherited from

PIXIDisplay.DisplayObject.ontouchstart


onwheel

onwheel: null | FederatedEventHandler<FederatedWheelEvent>

Handler for ‘wheel’ event

Inherited from

PIXIDisplay.DisplayObject.onwheel


parent

parent: Container<DisplayObject>

The display object container that contains this display object.

Inherited from

PIXIDisplay.DisplayObject.parent


renderId

Optional renderId: number

Inherited from

PIXIDisplay.DisplayObject.renderId


renderable

renderable: boolean

Can this object be rendered, if false the object will not be drawn but the updateTransform methods will still be called.

Only affects recursive calls from parent. You can ask for bounds manually.

Inherited from

PIXIDisplay.DisplayObject.renderable


tabIndex

Optional tabIndex: number

Inherited from

PIXIDisplay.DisplayObject.tabIndex


transform

transform: Transform

World transform and local transform of this object. This will become read-only later, please do not assign anything there unless you know what are you doing.

Inherited from

PIXIDisplay.DisplayObject.transform


visible

visible: boolean

The visibility of the object. If false the object will not be drawn, and the updateTransform function will not be called.

Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.

Inherited from

PIXIDisplay.DisplayObject.visible


worldAlpha

Readonly worldAlpha: number

The multiplied alpha of the displayObject.

Inherited from

PIXIDisplay.DisplayObject.worldAlpha


prefixed

Static prefixed: string | boolean

Inherited from

PIXIDisplay.DisplayObject.prefixed

Accessors

_tempDisplayObjectParent

get _tempDisplayObjectParent(): TemporaryDisplayObject

Returns

TemporaryDisplayObject

Member

Inherited from

PIXIDisplay.DisplayObject._tempDisplayObjectParent


angle

get angle(): number

The angle of the object in degrees. ‘rotation’ and ‘angle’ have the same effect on a display object; rotation is in radians, angle is in degrees.

Returns

number

Inherited from

PIXIDisplay.DisplayObject.angle

set angle(value): void

Parameters

Name Type
value number

Returns

void

Inherited from

PIXIDisplay.DisplayObject.angle


destroyed

get destroyed(): boolean

Readonly flag for destroyed display objects.

Returns

boolean

Inherited from

PIXIDisplay.DisplayObject.destroyed


localTransform

get localTransform(): Matrix

Current transform of the object based on local factors: position, scale, other stuff.

Returns

Matrix

Inherited from

PIXIDisplay.DisplayObject.localTransform


mask

get mask(): null | MaskData | Container<DisplayObject>

Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. In PixiJS a regular mask must be a PIXI.Graphics or a PIXI.Sprite object. This allows for much faster masking in canvas as it utilities shape clipping. Furthermore, a mask of an object must be in the subtree of its parent. Otherwise, getLocalBounds may calculate incorrect bounds, which makes the container’s width and height wrong. To remove a mask, set this property to null.

For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.

Returns

null | MaskData | Container<DisplayObject>

Example

import { Graphics, Sprite } from 'pixi.js';

const graphics = new Graphics();
graphics.beginFill(0xFF3300);
graphics.drawRect(50, 250, 100, 100);
graphics.endFill();

const sprite = new Sprite(texture);
sprite.mask = graphics;

Todo

At the moment, CanvasRenderer doesn’t support Sprite as mask.

Inherited from

PIXIDisplay.DisplayObject.mask

set mask(value): void

Parameters

Name Type
value null | MaskData | Container<DisplayObject>

Returns

void

Inherited from

PIXIDisplay.DisplayObject.mask


pivot

get pivot(): ObservablePoint<any>

The center of rotation, scaling, and skewing for this display object in its local space. The position is the projection of pivot in the parent’s local space.

By default, the pivot is the origin (0, 0).

Returns

ObservablePoint<any>

Since

4.0.0

Inherited from

PIXIDisplay.DisplayObject.pivot

set pivot(value): void

Parameters

Name Type
value IPointData

Returns

void

Inherited from

PIXIDisplay.DisplayObject.pivot


position

get position(): ObservablePoint<any>

The coordinate of the object relative to the local coordinates of the parent.

Returns

ObservablePoint<any>

Since

4.0.0

Inherited from

PIXIDisplay.DisplayObject.position

set position(value): void

Parameters

Name Type
value IPointData

Returns

void

Inherited from

PIXIDisplay.DisplayObject.position


rotation

get rotation(): number

The rotation of the object in radians. ‘rotation’ and ‘angle’ have the same effect on a display object; rotation is in radians, angle is in degrees.

Returns

number

Inherited from

PIXIDisplay.DisplayObject.rotation

set rotation(value): void

Parameters

Name Type
value number

Returns

void

Inherited from

PIXIDisplay.DisplayObject.rotation


scale

get scale(): ObservablePoint<any>

The scale factors of this object along the local coordinate axes.

The default scale is (1, 1).

Returns

ObservablePoint<any>

Since

4.0.0

Inherited from

PIXIDisplay.DisplayObject.scale

set scale(value): void

Parameters

Name Type
value IPointData

Returns

void

Inherited from

PIXIDisplay.DisplayObject.scale


skew

get skew(): ObservablePoint<any>

The skew factor for the object in radians.

Returns

ObservablePoint<any>

Since

4.0.0

Inherited from

PIXIDisplay.DisplayObject.skew

set skew(value): void

Parameters

Name Type
value IPointData

Returns

void

Inherited from

PIXIDisplay.DisplayObject.skew


sortDirty

get sortDirty(): boolean

Returns

boolean

Overrides

PIXIDisplay.DisplayObject.sortDirty


worldTransform

get worldTransform(): Matrix

Current transform of the object based on world (parent) factors.

Returns

Matrix

Inherited from

PIXIDisplay.DisplayObject.worldTransform


worldVisible

get worldVisible(): boolean

Indicates if the object is globally visible.

Returns

boolean

Inherited from

PIXIDisplay.DisplayObject.worldVisible


x

get x(): number

The position of the displayObject on the x axis relative to the local coordinates of the parent. An alias to position.x

Returns

number

Inherited from

PIXIDisplay.DisplayObject.x

set x(value): void

Parameters

Name Type
value number

Returns

void

Inherited from

PIXIDisplay.DisplayObject.x


y

get y(): number

The position of the displayObject on the y axis relative to the local coordinates of the parent. An alias to position.y

Returns

number

Inherited from

PIXIDisplay.DisplayObject.y

set y(value): void

Parameters

Name Type
value number

Returns

void

Inherited from

PIXIDisplay.DisplayObject.y


zIndex

get zIndex(): number

The zIndex of the displayObject.

If a container has the sortableChildren property set to true, children will be automatically sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, and thus rendered on top of other display objects within the same container.

Returns

number

See

PIXI.Container#sortableChildren

Inherited from

PIXIDisplay.DisplayObject.zIndex

set zIndex(value): void

Parameters

Name Type
value number

Returns

void

Inherited from

PIXIDisplay.DisplayObject.zIndex

Methods

_cacheAsBitmapDestroy

_cacheAsBitmapDestroy(options?): void

Parameters

Name Type
options? boolean | IDestroyOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject._cacheAsBitmapDestroy


_calculateCachedBounds

_calculateCachedBounds(): void

Returns

void

Inherited from

PIXIDisplay.DisplayObject._calculateCachedBounds


_destroyCachedDisplayObject

_destroyCachedDisplayObject(): void

Returns

void

Inherited from

PIXIDisplay.DisplayObject._destroyCachedDisplayObject


_getCachedLocalBounds

_getCachedLocalBounds(): Rectangle

Returns

Rectangle

Inherited from

PIXIDisplay.DisplayObject._getCachedLocalBounds


_initCachedDisplayObject

_initCachedDisplayObject(renderer): void

Parameters

Name Type
renderer Renderer

Returns

void

Inherited from

PIXIDisplay.DisplayObject._initCachedDisplayObject


_initCachedDisplayObjectCanvas

_initCachedDisplayObjectCanvas(renderer): void

Parameters

Name Type
renderer IRenderer<ICanvas>

Returns

void

Inherited from

PIXIDisplay.DisplayObject._initCachedDisplayObjectCanvas


_recursivePostUpdateTransform

_recursivePostUpdateTransform(): void

Recursively updates transform of all objects from the root to this one internal function for toLocal()

Returns

void

Inherited from

PIXIDisplay.DisplayObject._recursivePostUpdateTransform


_renderCached

_renderCached(renderer): void

Parameters

Name Type
renderer Renderer

Returns

void

Inherited from

PIXIDisplay.DisplayObject._renderCached


_renderCachedCanvas

_renderCachedCanvas(renderer): void

Parameters

Name Type
renderer IRenderer<ICanvas>

Returns

void

Inherited from

PIXIDisplay.DisplayObject._renderCachedCanvas


addEventListener

addEventListener<K>(type, listener, options?): void

Type parameters

Name Type
K extends keyof FederatedEventMap | keyof GlobalFederatedEventMap

Parameters

Name Type
type K
listener (e: AllFederatedEventMap[K]) => any
options? AddListenerOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject.addEventListener

addEventListener(type, listener, options?): void

Parameters

Name Type
type string
listener EventListenerOrEventListenerObject
options? AddListenerOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject.addEventListener


addListener

addListener<T>(event, fn, context?): this

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
fn (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void
context? any

Returns

this

Inherited from

PIXIDisplay.DisplayObject.addListener


calculateBounds

calculateBounds(): void

Returns

void

Overrides

PIXIDisplay.DisplayObject.calculateBounds


destroy

destroy(_options?): void

Base destroy method for generic display objects. This will automatically remove the display object from its parent Container as well as remove all current event listeners and internal references. Do not use a DisplayObject after calling destroy().

Parameters

Name Type
_options? boolean | IDestroyOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject.destroy


disableTempParent

disableTempParent(cacheParent): void

Pair method for enableTempParent

Parameters

Name Type Description
cacheParent Container<DisplayObject> Actual parent of element

Returns

void

Inherited from

PIXIDisplay.DisplayObject.disableTempParent


dispatchEvent

dispatchEvent(event): boolean

Dispatches a synthetic event event to target and returns true if either event’s cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

MDN Reference

Parameters

Name Type
event Event

Returns

boolean

Inherited from

PIXIDisplay.DisplayObject.dispatchEvent


emit

emit<T>(event, ...args): boolean

Calls each of the listeners registered for a given event.

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
...args ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]

Returns

boolean

Inherited from

PIXIDisplay.DisplayObject.emit


enableTempParent

enableTempParent(): Container<DisplayObject>

Used in Renderer, cacheAsBitmap and other places where you call an updateTransform on root.

const cacheParent = elem.enableTempParent();
elem.updateTransform();
elem.disableTempParent(cacheParent);

Returns

Container<DisplayObject>

  • Current parent

Inherited from

PIXIDisplay.DisplayObject.enableTempParent


eventNames

eventNames(): keyof DisplayObjectEvents[]

Return an array listing the events for which the emitter has registered listeners.

Returns

keyof DisplayObjectEvents[]

Inherited from

PIXIDisplay.DisplayObject.eventNames


getBounds

getBounds(skipUpdate?, rect?): Rectangle

Calculates and returns the (world) bounds of the display object as a [Rectangle]PIXI.Rectangle.

This method is expensive on containers with a large subtree (like the stage). This is because the bounds of a container depend on its children’s bounds, which recursively causes all bounds in the subtree to be recalculated. The upside, however, is that calling getBounds once on a container will indeed update the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using displayObject._bounds.getRectangle() when traversing through all the bounds in a scene graph. Otherwise, calling getBounds on each object in a subtree will cause the total cost to increase quadratically as its height increases.

The transforms of all objects in a container’s subtree and of all ancestors are updated. The world bounds of all display objects in a container’s subtree will also be recalculated.

The _bounds object stores the last calculation of the bounds. You can use to entirely skip bounds calculation if needed.

const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);

Do know that usage of getLocalBounds can corrupt the _bounds of children (the whole subtree, actually). This is a known issue that has not been solved. See [getLocalBounds]PIXI.DisplayObject#getLocalBounds for more details.

getBounds should be called with skipUpdate equal to true in a render() call. This is because the transforms are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain cases.

Parameters

Name Type Description
skipUpdate? boolean Setting to true will stop the transforms of the scene graph from being updated. This means the calculation returned MAY be out of date BUT will give you a nice performance boost.
rect? Rectangle Optional rectangle to store the result of the bounds calculation.

Returns

Rectangle

  • The minimum axis-aligned rectangle in world space that fits around this object.

Inherited from

PIXIDisplay.DisplayObject.getBounds


getLocalBounds

getLocalBounds(rect?): Rectangle

Retrieves the local bounds of the displayObject as a rectangle object.

Parameters

Name Type Description
rect? Rectangle Optional rectangle to store the result of the bounds calculation.

Returns

Rectangle

  • The rectangular bounding area.

Inherited from

PIXIDisplay.DisplayObject.getLocalBounds


listenerCount

listenerCount(event): number

Return the number of listeners listening to a given event.

Parameters

Name Type
event keyof DisplayObjectEvents

Returns

number

Inherited from

PIXIDisplay.DisplayObject.listenerCount


listeners

listeners<T>(event): (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void[]

Return the listeners registered for a given event.

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T

Returns

(…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void[]

Inherited from

PIXIDisplay.DisplayObject.listeners


off

off<T>(event, fn?, context?, once?): this

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
fn? (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void
context? any
once? boolean

Returns

this

Inherited from

PIXIDisplay.DisplayObject.off


on

on<T>(event, fn, context?): this

Add a listener for a given event.

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
fn (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void
context? any

Returns

this

Inherited from

PIXIDisplay.DisplayObject.on


once

once<T>(event, fn, context?): this

Add a one-time listener for a given event.

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
fn (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void
context? any

Returns

this

Inherited from

PIXIDisplay.DisplayObject.once


removeAllListeners

removeAllListeners(event?): this

Remove all listeners, or those of the specified event.

Parameters

Name Type
event? keyof DisplayObjectEvents

Returns

this

Inherited from

PIXIDisplay.DisplayObject.removeAllListeners


removeChild

removeChild(child): void

Parameters

Name Type
child DisplayObject

Returns

void

Overrides

PIXIDisplay.DisplayObject.removeChild


removeEventListener

removeEventListener<K>(type, listener, options?): void

Type parameters

Name Type
K extends keyof FederatedEventMap | keyof GlobalFederatedEventMap

Parameters

Name Type
type K
listener (e: AllFederatedEventMap[K]) => any
options? RemoveListenerOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject.removeEventListener

removeEventListener(type, listener, options?): void

Parameters

Name Type
type string
listener EventListenerOrEventListenerObject
options? RemoveListenerOptions

Returns

void

Inherited from

PIXIDisplay.DisplayObject.removeEventListener


removeFromParent

removeFromParent(): void

Remove the DisplayObject from its parent Container. If the DisplayObject has no parent, do nothing.

Returns

void

Inherited from

PIXIDisplay.DisplayObject.removeFromParent


removeListener

removeListener<T>(event, fn?, context?, once?): this

Remove the listeners of a given event.

Type parameters

Name Type
T extends keyof DisplayObjectEvents

Parameters

Name Type
event T
fn? (…args: ArgumentMap<DisplayObjectEvents>[Extract<T, keyof DisplayObjectEvents>]) => void
context? any
once? boolean

Returns

this

Inherited from

PIXIDisplay.DisplayObject.removeListener


render

render(renderer): void

Parameters

Name Type
renderer Renderer

Returns

void

Overrides

PIXIDisplay.DisplayObject.render


setParent

setParent(container): Container<DisplayObject>

Set the parent Container of this DisplayObject.

Parameters

Name Type Description
container Container<DisplayObject> The Container to add this DisplayObject to.

Returns

Container<DisplayObject>

  • The Container that this DisplayObject was added to.

Inherited from

PIXIDisplay.DisplayObject.setParent


setTransform

setTransform(x?, y?, scaleX?, scaleY?, rotation?, skewX?, skewY?, pivotX?, pivotY?): this

Convenience function to set the position, scale, skew and pivot at once.

Parameters

Name Type Description
x? number The X position
y? number The Y position
scaleX? number The X scale value
scaleY? number The Y scale value
rotation? number The rotation
skewX? number The X skew value
skewY? number The Y skew value
pivotX? number The X pivot value
pivotY? number The Y pivot value

Returns

this

  • The DisplayObject instance

Inherited from

PIXIDisplay.DisplayObject.setTransform


toGlobal

toGlobal<P>(position, point?, skipUpdate?): P

Calculates the global position of the display object.

Type parameters

Name Type
P extends IPointData = Point

Parameters

Name Type Description
position IPointData The world origin to calculate from.
point? P A Point object in which to store the value, optional (otherwise will create a new Point).
skipUpdate? boolean Should we skip the update transform.

Returns

P

  • A point object representing the position of this object.

Inherited from

PIXIDisplay.DisplayObject.toGlobal


toLocal

toLocal<P>(position, from?, point?, skipUpdate?): P

Calculates the local position of the display object relative to another point.

Type parameters

Name Type
P extends IPointData = Point

Parameters

Name Type Description
position IPointData The world origin to calculate from.
from? DisplayObject The DisplayObject to calculate the global position from.
point? P A Point object in which to store the value, optional (otherwise will create a new Point).
skipUpdate? boolean Should we skip the update transform

Returns

P

  • A point object representing the position of this object

Inherited from

PIXIDisplay.DisplayObject.toLocal


updateTransform

updateTransform(): void

Returns

void

Overrides

PIXIDisplay.DisplayObject.updateTransform


mixin

mixin(source): void

Mixes all enumerable properties and methods from a source object to DisplayObject.

Parameters

Name Type Description
source Dict<any> The source of properties and methods to mix in.

Returns

void

Inherited from

PIXIDisplay.DisplayObject.mixin