Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ImageExtendedNode

Hierarchy

  • Node
    • ImageExtendedNode

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Protected _active

_active: boolean = true

Protected _activeInHierarchy

_activeInHierarchy: boolean = false

Protected _children

_children: this[] = []

Protected _components

_components: Component[] = []

Protected _dirtyFlags

_dirtyFlags: TransformBit = TransformBit.NONE

Protected _euler

_euler: Vec3 = new Vec3()

Protected _eulerDirty

_eulerDirty: boolean = false

Protected _eventMask

_eventMask: number = 0

Protected _eventProcessor

_eventProcessor: any = new legacyCC.NodeEventProcessor(this)

Protected _id

_id: string = idGenerator.getNewId()

Protected _layer

_layer: number = Layers.Enum.DEFAULT

Protected _lpos

_lpos: Vec3 = new Vec3()

Protected _lrot

_lrot: Quat = new Quat()

Protected _lscale

_lscale: Vec3 = new Vec3(1, 1, 1)

Protected _mat

_mat: Mat4 = new Mat4()

Protected _name

_name: string

_objFlags

_objFlags: number

_offset

_offset: Vec2

Protected _parent

_parent: this | null = null

Protected _poolHandle

_poolHandle: NodeHandle = NULL_HANDLE

Protected _pos

_pos: Vec3 = new Vec3()

Protected _prefab

_prefab: PrefabInfo | null = null

Protected _registerIfAttached

_registerIfAttached: undefined | _registerIfAttached = !EDITOR ? undefined : function _registerIfAttached (this: BaseNode, register) {if (EditorExtends.Node && EditorExtends.Component) {if (register) {EditorExtends.Node.add(this._id, this);for (let i = 0; i < this._components.length; i++) {const comp = this._components[i];EditorExtends.Component.add(comp._id, comp);}} else {for (let i = 0; i < this._components.length; i++) {const comp = this._components[i];EditorExtends.Component.remove(comp._id);}EditorExtends.Node.remove(this._id);}}const children = this._children;for (let i = 0, len = children.length; i < len; ++i) {const child = children[i];child._registerIfAttached!(register);}}

Protected _rot

_rot: Quat = new Quat()

Protected _scale

_scale: Vec3 = new Vec3(1, 1, 1)

Protected _scene

_scene: Scene = null!

Protected _siblingIndex

_siblingIndex: number = 0

_static

_static: boolean = false

_uiProps

_uiProps: NodeUIProperties = new NodeUIProperties(this)

layerInfo

Static EventType

EventType: SystemEventType = SystemEventType

Event types emitted by Node

Static NodeSpace

NodeSpace: NodeSpace = NodeSpace

Coordinates space

Static TransformBit

TransformBit: TransformBit = TransformBit

Bit masks for Node transformation parts, can be used to determine which part changed in SystemEventType.TRANSFORM_CHANGED event

Static TransformDirtyBit

TransformDirtyBit: TransformBit = TransformBit

Bit masks for Node transformation parts

deprecated

please use Node.TransformBit

Static Protected _stackId

_stackId: number = 0

Static Protected _stacks

_stacks: Array<Array<null | BaseNode>> = [[]]

Static bookOfChange

bookOfChange: Map<Node, number> = bookOfChange

Static Protected idGenerator

idGenerator: IDGenerator = idGenerator

Accessors

Protected persistNode

  • get persistNode(): boolean
  • set persistNode(value: boolean): void
  • en

    If true, the node is an persist node which won't be destroyed during scene transition. If false, the node will be destroyed automatically when loading a new scene. Default is false.

    zh

    如果为true,则该节点是一个常驻节点,不会在场景转换期间被销毁。 如果为false,节点将在加载新场景时自动销毁。默认为 false。

    default

    false

    Returns boolean

  • en

    If true, the node is an persist node which won't be destroyed during scene transition. If false, the node will be destroyed automatically when loading a new scene. Default is false.

    zh

    如果为true,则该节点是一个常驻节点,不会在场景转换期间被销毁。 如果为false,节点将在加载新场景时自动销毁。默认为 false。

    default

    false

    Parameters

    • value: boolean

    Returns void

active

  • get active(): boolean
  • set active(isActive: boolean): void
  • en

    The local active state of this node. Note that a Node may be inactive because a parent is not active, even if this returns true. Use activeInHierarchy if you want to check if the Node is actually treated as active in the scene.

    zh

    当前节点的自身激活状态。 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。 如果你想检查节点在场景中实际的激活状态可以使用 activeInHierarchy

    default

    true

    Returns boolean

  • en

    The local active state of this node. Note that a Node may be inactive because a parent is not active, even if this returns true. Use activeInHierarchy if you want to check if the Node is actually treated as active in the scene.

    zh

    当前节点的自身激活状态。 值得注意的是,一个节点的父节点如果不被激活,那么即使它自身设为激活,它仍然无法激活。 如果你想检查节点在场景中实际的激活状态可以使用 activeInHierarchy

    default

    true

    Parameters

    • isActive: boolean

    Returns void

activeInHierarchy

  • get activeInHierarchy(): boolean

angle

  • get angle(): number
  • set angle(val: number): void
  • en

    Rotation in local coordinate system, represented by euler angles, but limited on z axis

    zh

    本地坐标系下的旋转,用欧拉角表示,但是限定在 z 轴上。

    Returns number

  • en

    Rotation in local coordinate system, represented by euler angles, but limited on z axis

    zh

    本地坐标系下的旋转,用欧拉角表示,但是限定在 z 轴上。

    Parameters

    • val: number

    Returns void

children

  • get children(): this[]

components

eulerAngles

  • get eulerAngles(): {}
  • set eulerAngles(val: Readonly<Vec3>): void

eventProcessor

  • get eventProcessor(): any

forward

  • get forward(): Vec3
  • set forward(dir: Vec3): void
  • en

    The vector representing forward direction in local coordinate system, it's the minus z direction by default

    zh

    当前节点面向的前方方向,默认前方为 -z 方向

    Returns Vec3

  • en

    The vector representing forward direction in local coordinate system, it's the minus z direction by default

    zh

    当前节点面向的前方方向,默认前方为 -z 方向

    Parameters

    Returns void

handle

  • get handle(): NodeHandle

hasChangedFlags

  • get hasChangedFlags(): number
  • set hasChangedFlags(val: number): void

isValid

  • get isValid(): boolean
  • en

    Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)
    When an object's destroy is called, it is actually destroyed after the end of this frame. So isValid will return false from the next frame, while isValid in the current frame will still be true. If you want to determine whether the current frame has called destroy, use isValid(obj, true), but this is often caused by a particular logical requirements, which is not normally required.

    zh

    表示该对象是否可用(被 destroy 后将不可用)。
    当一个对象的 destroy 调用以后,会在这一帧结束后才真正销毁。
    因此从下一帧开始 isValid 就会返回 false,而当前帧内 isValid 仍然会是 true。
    如果希望判断当前帧是否调用过 destroy,请使用 isValid(obj, true),不过这往往是特殊的业务需求引起的,通常情况下不需要这样。

    default

    true

    readonly
    example
    import { Node, log } from 'cc';
    const node = new Node();
    log(node.isValid);    // true
    node.destroy();
    log(node.isValid);    // true, still valid in this frame
    // after a frame...
    log(node.isValid);    // false, destroyed in the end of last frame

    Returns boolean

layer

  • get layer(): number
  • set layer(l: number): void

matrix

  • set matrix(val: Readonly<Mat4>): void

name

  • get name(): string
  • set name(value: string): void

parent

  • get parent(): null | this
  • set parent(value: null | this): void

position

  • get position(): Readonly<Vec3>
  • set position(val: Readonly<Vec3>): void

rotation

  • get rotation(): Readonly<Quat>
  • set rotation(val: Readonly<Quat>): void

scale

  • get scale(): Readonly<Vec3>
  • set scale(val: Readonly<Vec3>): void

scene

uuid

  • get uuid(): string
  • en

    The uuid for editor, will be stripped after building project.

    zh

    主要用于编辑器的 uuid,在编辑器下可用于持久化存储,在项目构建之后将变成自增的 id。

    readonly

    Returns string

worldMatrix

  • get worldMatrix(): Readonly<Mat4>

worldPosition

  • get worldPosition(): Readonly<Vec3>
  • set worldPosition(val: Readonly<Vec3>): void

worldRotation

  • get worldRotation(): Readonly<Quat>
  • set worldRotation(val: Readonly<Quat>): void

worldScale

  • get worldScale(): Readonly<Vec3>
  • set worldScale(val: Readonly<Vec3>): void

Methods

Protected Optional checkMultipleComp

  • checkMultipleComp<T>(constructor: Constructor<T>): void

destroyImmediate

  • _destroyImmediate(): void

destruct

  • _destruct(): void
  • Clear all references in the instance.

    NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject. You can override the _destruct method if you need, for example: _destruct: function () { for (var key in this) { if (this.hasOwnProperty(key)) { switch (typeof this[key]) { case 'string': this[key] = ''; break; case 'object': case 'function': this[key] = null; break; } } }

    Returns void

Protected instantiate

  • instantiate(cloned: any, isSyncedNode: any): any

onBatchCreated

  • onBatchCreated(dontSyncChildPrefab: boolean): void

onBeforeSerialize

  • _onBeforeSerialize(): void

Protected onHierarchyChanged

  • onHierarchyChanged(oldParent: this | null): void

Protected onHierarchyChangedBase

  • onHierarchyChangedBase(oldParent: this | null): void

onPostActivated

  • onPostActivated(active: boolean): void

Protected onPreDestroy

  • _onPreDestroy(): void

Protected onPreDestroyBase

  • _onPreDestroyBase(): boolean

onSetParent

  • onSetParent(oldParent: this | null, keepWorldTransform: boolean): void

Protected Optional onSiblingIndexChanged

  • onSiblingIndexChanged(siblingIndex: number): void

removeComponent

  • removeComponent(component: Component): void

Protected updateScene

  • _updateScene(): void

updateSiblingIndex

  • _updateSiblingIndex(): void

addChild

  • addChild(child: this | Node): void

addComponent

  • Adds a component class to the node. You can also add component to node by passing in the name of the script.

    throws

    TypeError if the className does not specify a cc-class constructor extending the Component.

    example
    var test = node.addComponent("Test");

    Type parameters

    Parameters

    • classConstructor: Constructor<T>

      The class of the component to add

    Returns T

  • Adds a component class to the node. You can also add component to node by passing in the name of the script.

    throws

    TypeError if the className does not specify a cc-class constructor extending the Component.

    example
    var test = node.addComponent("Test");

    Parameters

    • className: string

      The class name of the component to add

    Returns Component

attr

  • attr(attrs: unknown): void
  • Properties configuration function. All properties in attrs will be set to the node, when the setter of the node is available, the property will be set via setter function.

    example
    var attrs = { name: 'New Name', active: false };
    node.attr(attrs);

    Parameters

    • attrs: unknown

      Properties to be set to node

    Returns void

destroy

  • destroy(): boolean

destroyAllChildren

  • destroyAllChildren(): void

dispatchEvent

  • dispatchEvent(event: Event): void

emit

  • emit(type: string, arg0?: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any): void
  • Trigger an event directly with the event name and necessary arguments.

    example
    eventTarget.emit('fire', event);
    eventTarget.emit('fire', message, emitter);

    Parameters

    • type: string

      event type

    • Optional arg0: any
    • Optional arg1: any

      First argument in callback

    • Optional arg2: any

      Second argument in callback

    • Optional arg3: any

      Third argument in callback

    • Optional arg4: any

      Fourth argument in callback

    Returns void

getChildByName

  • getChildByName(name: string): null | this
  • Returns a child with the same name.

    example
    var child = node.getChildByName("Test Node");

    Parameters

    • name: string

      A name to find the child node.

    Returns null | this

    a CCNode object whose name equals to the input parameter

getChildByPath

  • getChildByPath(path: string): null | this
  • Returns a child with the given path.

    example
    var child = node.getChildByPath("subNode/Test Node");

    Parameters

    • path: string

      A path to find the child node.

    Returns null | this

    a Node object whose path equals to the input parameter

getChildByUuid

  • getChildByUuid(uuid: string): null | this

getComponent

  • getComponent<T>(classConstructor: Constructor<T>): T | null
  • getComponent(className: string): Component | null
  • Returns the component of supplied type if the node has one attached, null if it doesn't. You can also get component in the node by passing in the name of the script.

    example
    // get custom test class.
    var test = node.getComponent("Test");

    Type parameters

    Parameters

    • classConstructor: Constructor<T>

      The class of the target component

    Returns T | null

  • Returns the component of supplied type if the node has one attached, null if it doesn't. You can also get component in the node by passing in the name of the script.

    example
    // get custom test class.
    var test = node.getComponent("Test");

    Parameters

    • className: string

      The class name of the target component

    Returns Component | null

getComponentInChildren

  • getComponentInChildren<T>(classConstructor: Constructor<T>): T | null
  • getComponentInChildren(className: string): Component | null

getComponents

  • getComponents<T>(classConstructor: Constructor<T>): T[]
  • getComponents(className: string): Component[]

getComponentsInChildren

  • getComponentsInChildren<T>(classConstructor: Constructor<T>): T[]
  • getComponentsInChildren(className: string): Component[]

getParent

  • getParent(): null | this

getPosition

  • Get position in local coordinate system, please try to pass out vector and reuse it to avoid garbage.

    Parameters

    • Optional out: Vec3

      Set the result to out vector

    Returns Vec3

    If out given, the return value equals to out, otherwise a new vector will be generated and return

getRotation

  • Get rotation as quaternion in local coordinate system, please try to pass out quaternion and reuse it to avoid garbage.

    Parameters

    • Optional out: Quat

      Set the result to out quaternion

    Returns Quat

    If out given, the return value equals to out, otherwise a new quaternion will be generated and return

getScale

  • Get scale in local coordinate system, please try to pass out vector and reuse it to avoid garbage.

    Parameters

    • Optional out: Vec3

      Set the result to out vector

    Returns Vec3

    If out given, the return value equals to out, otherwise a new vector will be generated and return

getSiblingIndex

  • getSiblingIndex(): number

getWorldMatrix

getWorldPosition

  • Get position in world coordinate system, please try to pass out vector and reuse it to avoid garbage.

    Parameters

    • Optional out: Vec3

      Set the result to out vector

    Returns Vec3

    If out given, the return value equals to out, otherwise a new vector will be generated and return

getWorldRS

getWorldRT

  • Get a world transform matrix with only rotation and translation

    Parameters

    • Optional out: Mat4

      Set the result to out matrix

    Returns Mat4

    If out given, the return value equals to out, otherwise a new matrix will be generated and return

getWorldRotation

  • Get rotation as quaternion in world coordinate system, please try to pass out quaternion and reuse it to avoid garbage.

    Parameters

    • Optional out: Quat

      Set the result to out quaternion

    Returns Quat

    If out given, the return value equals to out, otherwise a new quaternion will be generated and return

getWorldScale

  • Get scale in world coordinate system, please try to pass out vector and reuse it to avoid garbage.

    Parameters

    • Optional out: Vec3

      Set the result to out vector

    Returns Vec3

    If out given, the return value equals to out, otherwise a new vector will be generated and return

hasEventListener

  • hasEventListener(type: string, callback?: AnyFunction, target?: unknown): any
  • Checks whether the EventTarget object has any callback registered for a specific type of event.

    Parameters

    • type: string

      The type of event.

    • Optional callback: AnyFunction

      The callback function of the event listener, if absent all event listeners for the given type will be removed

    • Optional target: unknown

      The callback callee of the event listener

    Returns any

    True if a callback of the specified type is registered; false otherwise.

insertChild

  • insertChild(child: this | Node, siblingIndex: number): void
  • Inserts a child to the node at a specified index.

    example
    node.insertChild(child, 2);

    Parameters

    • child: this | Node

      the child node to be inserted

    • siblingIndex: number

      the sibling index to place the child in

    Returns void

invalidateChildren

inverseTransformPoint

isChildOf

  • isChildOf(parent: this | Scene | null): boolean

lookAt

off

  • off(type: string, callback?: AnyFunction, target?: unknown, useCapture?: any): void
  • Removes the callback previously registered with the same type, callback, target and or useCapture. This method is merely an alias to removeEventListener.

    example
    this.node.off(SystemEventType.TOUCH_START, this.memberFunction, this);
    node.off(SystemEventType.TOUCH_START, callback, this.node);

    Parameters

    • type: string

      A string representing the event type being removed.

    • Optional callback: AnyFunction

      The callback to remove.

    • Optional target: unknown

      The target (this object) to invoke the callback, if it's not given, only callback without target will be removed

    • Default value useCapture: any = false

      When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.

    Returns void

on

  • on(type: string | SystemEventType, callback: AnyFunction, target?: unknown, useCapture?: any): void
  • Register a callback of a specific event type on Node. Use this method to register touch or mouse event permit propagation based on scene graph, These kinds of event are triggered with dispatchEvent, the dispatch process has three steps:

    1. Capturing phase: dispatch in capture targets (_getCapturingTargets), e.g. parents in node tree, from root to the real target
    2. At target phase: dispatch to the listeners of the real target
    3. Bubbling phase: dispatch in bubble targets (_getBubblingTargets), e.g. parents in node tree, from the real target to root In any moment of the dispatching process, it can be stopped via event.stopPropagation() or event.stopPropagationImmediate(). It's the recommended way to register touch/mouse event for Node, please do not use eventManager directly for Node. You can also register custom event and use emit to trigger custom event on Node. For such events, there won't be capturing and bubbling phase, your event will be dispatched directly to its listeners registered on the same node. You can also pass event callback parameters with emit by passing parameters after type.
    example
    this.node.on(SystemEventType.TOUCH_START, this.memberFunction, this);  // if "this" is component and the "memberFunction" declared in CCClass.
    node.on(SystemEventType.TOUCH_START, callback, this);
    node.on(SystemEventType.TOUCH_MOVE, callback, this);
    node.on(SystemEventType.TOUCH_END, callback, this);

    Parameters

    • type: string | SystemEventType

      A string representing the event type to listen for.
      See {{#crossLink "Node/EventType/POSITION_CHANGED"}}Node Events{{/crossLink}} for all builtin events.

    • callback: AnyFunction

      The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).

    • Optional target: unknown

      The target (this object) to invoke the callback, can be null

    • Default value useCapture: any = false

      When set to true, the listener will be triggered at capturing phase which is ahead of the final target emit, otherwise it will be triggered during bubbling phase.

    Returns void

    • Just returns the incoming callback so you can save the anonymous function easier.

once

  • once(type: string, callback: AnyFunction, target?: unknown, useCapture?: any): void
  • Register an callback of a specific event type on the Node, the callback will remove itself after the first time it is triggered.

    Parameters

    • type: string

      A string representing the event type to listen for.

    • callback: AnyFunction

      The callback that will be invoked when the event is dispatched. The callback is ignored if it is a duplicate (the callbacks are unique).

    • Optional target: unknown

      The target (this object) to invoke the callback, can be null

    • Optional useCapture: any

    Returns void

pauseSystemEvents

  • pauseSystemEvents(recursive: boolean): void
  • Pause all system events which is dispatched by SystemEvent. If recursive is set to true, then this API will pause the node system events for the node and all nodes in its sub node tree.

    Parameters

    • recursive: boolean

      Whether pause system events recursively for the child node tree

    Returns void

removeAllChildren

  • removeAllChildren(): void

removeChild

  • removeChild(child: this | Node): void

removeComponent

  • removeComponent<T>(classConstructor: Constructor<T>): void
  • removeComponent(classNameOrInstance: string | Component): void
  • Removes a component identified by the given name or removes the component object given. You can also use component.destroy() if you already have the reference.

    deprecated

    please destroy the component to remove it.

    example
    import { Sprite } from 'cc';
    const sprite = node.getComponent(Sprite);
    if (sprite) {
        node.removeComponent(sprite);
    }
    node.removeComponent('Sprite');

    Type parameters

    Parameters

    • classConstructor: Constructor<T>

      The class of the component to remove

    Returns void

  • Removes a component identified by the given name or removes the component object given. You can also use component.destroy() if you already have the reference.

    deprecated

    please destroy the component to remove it.

    example
    import { Sprite } from 'cc';
    const sprite = node.getComponent(Sprite);
    if (sprite) {
        node.removeComponent(sprite);
    }
    node.removeComponent('Sprite');

    Parameters

    • classNameOrInstance: string | Component

      The class name of the component to remove or the component instance to be removed

    Returns void

removeFromParent

  • removeFromParent(): void

resumeSystemEvents

  • resumeSystemEvents(recursive: boolean): void
  • Resume all paused system events which is dispatched by SystemEvent. If recursive is set to true, then this API will resume the node system events for the node and all nodes in its sub node tree.

    Parameters

    • recursive: boolean

      Whether resume system events recursively for the child node tree

    Returns void

rotate

setParent

  • setParent(value: this | null, keepWorldTransform?: boolean): void

setPosition

  • setPosition(position: Vec3): void
  • setPosition(x: number, y: number, z?: undefined | number): void

setRTS

setRotation

  • setRotation(rotation: Quat): void
  • setRotation(x: number, y: number, z: number, w: number): void

setRotationFromEuler

  • setRotationFromEuler(rotation: Vec3): void
  • setRotationFromEuler(x: number, y: number, zOpt?: undefined | number): void

setScale

  • setScale(scale: Vec3): void
  • setScale(x: number, y: number, z?: undefined | number): void

setSiblingIndex

  • setSiblingIndex(index: number): void

setWorldPosition

  • setWorldPosition(position: Vec3): void
  • setWorldPosition(x: number, y: number, z: number): void

setWorldRotation

  • setWorldRotation(rotation: Quat): void
  • setWorldRotation(x: number, y: number, z: number, w: number): void

setWorldRotationFromEuler

  • setWorldRotationFromEuler(x: number, y: number, z: number): void

setWorldScale

  • setWorldScale(scale: Vec3): void
  • setWorldScale(x: number, y: number, z: number): void

targetOff

  • targetOff(target: string | unknown): void

translate

updateWorldTransform

  • updateWorldTransform(): void

walk

  • walk(preFunc: (target: this) => void, postFunc?: undefined | ((target: this) => void)): void
  • Walk though the sub children tree of the current node. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children. This function call is not recursive, it's based on stack. Please don't walk any other node inside the walk process.

    example
    node.walk(function (target) {
        console.log('Walked through node ' + target.name + ' for the first time');
    }, function (target) {
        console.log('Walked through node ' + target.name + ' after walked all children in its sub tree');
    });

    Parameters

    • preFunc: (target: this) => void

      The callback to process node when reach the node for the first time

        • (target: this): void
        • Parameters

          • target: this

          Returns void

    • Optional postFunc: undefined | ((target: this) => void)

      The callback to process node when re-visit the node after walked all children in its sub tree

    Returns void

Static deferredDestroy

  • _deferredDestroy(): void

Static Protected findChildComponent

Static Protected findChildComponents

  • findChildComponents(children: BaseNode[], constructor: any, components: any): void

Static Protected findComponent

Static Protected findComponents

Static Protected setScene

Static isNode

  • isNode(obj: unknown): obj is Node

Generated using TypeDoc