xr-frame / Exports / CubeShape

# Class: CubeShape

为当前元素创建一个可交互的长方体轮廓。 可通过在标签上添加cube-shape属性来为元素添加该组件。

see ICubeShapeData

# Hierarchy

# Table of contents

# Constructors

# Events

# Properties

# Accessors

# Methods

# Constructors

# constructor

new CubeShape()

# Inherited from

Shape.constructor

# Events

# onAdd

onAdd(parent, data): void

所挂载的element被挂载到场景时触发的回调。

# Parameters

Name Type
parent Element
data ICubeShapeData

# Returns

void

# Inherited from

Shape.onAdd


# onRelease

onRelease(data): void

从被挂载的element上被移除,或是element被销毁时,触发的回调。 一般用于释放持有的资源。

# Parameters

Name Type
data IShapeData

# Returns

void

# Inherited from

Shape.onRelease


# onRemove

onRemove(parent, data): void

所挂载的element从父节点parent被移除时,或者自己从element上被移除时,触发的回调。 一般用于消除功能的运作。 如果一个组件的元素直接被销毁了,那这个组件就不会经历onRemove而是直接进入onRelease。

# Parameters

Name Type
parent Element
data IShapeData

# Returns

void

# Inherited from

Shape.onRemove


# onTick

onTick(dateTime, data): void

渲染每帧触发的回调。

# Parameters

Name Type
dateTime number
data ICubeShapeData

# Returns

void

# Inherited from

Shape.onTick


# onUpdate

onUpdate(data, preData): void

数据更新时触发的回调。

# Parameters

Name Type
data ICubeShapeData
preData ICubeShapeData

# Returns

void

# Inherited from

Shape.onUpdate

# Properties

# implType

implType: ShapeImplType

# Inherited from

Shape.implType


# priority

Readonly priority: number = 400

自定义组件的更新优先级。

# Inherited from

Shape.priority


# schema

Readonly schema: IComponentSchema

自定义组件的schema

# Overrides

Shape.schema


# shadowRoot

Optional shadowRoot: GLTFAbstractShape<ICubeShapeData>

# Inherited from

Shape.shadowRoot


# EVENTS

Static EVENTS: string[]

# Overrides

Shape.EVENTS

# Accessors

# el

get el(): Element

挂载的元素。

# Returns

Element


# scene

get scene(): Scene

当前场景。

# Returns

Scene


# type

get type(): EShapeType

# Returns

EShapeType


# version

get version(): number

当前版本,每次有数据更新都会增加,可以用作和其他组件合作的依据。

# Returns

number

# Methods

# getBasicImpl

getBasicImpl(): BasicShape<ICubeShapeData>

# Returns

BasicShape<ICubeShapeData>

# Inherited from

Shape.getBasicImpl


# getData

getData<T>(key): IShapeData[T]

获取一个当前值。

# Type parameters

Name Type
T extends keyof IShapeData

# Parameters

Name Type
key T

# Returns

IShapeData[T]

# Inherited from

Shape.getData


# getGLTFRootShape

getGLTFRootShape(): Shape<ICubeShapeData>

# Returns

Shape<ICubeShapeData>

# Inherited from

Shape.getGLTFRootShape


# getShadowShapes

getShadowShapes(): Shape<ICubeShapeData>[]

# Returns

Shape<ICubeShapeData>[]

# Inherited from

Shape.getShadowShapes


# initDelegates

initDelegates(el): void

# Parameters

Name Type
el Element

# Returns

void

# Inherited from

Shape.initDelegates


# resetListeners

resetListeners(): void

# Returns

void

# Inherited from

Shape.resetListeners


# setAsShadow

setAsShadow(root, transform): void

# Parameters

Name Type
root GLTFAbstractShape<ICubeShapeData>
transform TQS

# Returns

void

# Inherited from

Shape.setAsShadow


# setData

setData(data): void

不通过xml而是直接设置data,注意值的类型需要和schema中一致。

# Parameters

Name Type
data Partial<IShapeData>

# Returns

void

# Inherited from

Shape.setData


# setDataOne

setDataOne<T>(key, value): void

设置一个数据。

# Type parameters

Name Type
T extends keyof IShapeData

# Parameters

Name Type
key T
value IShapeData[T]

# Returns

void

# Inherited from

Shape.setDataOne