Skip to content

@simversus/yjvisDocs


@simversus/yjvis / TransformControl

Class: TransformControl

变换控制器,用于控制物体的位置、旋转、缩放

Extends

Constructors

new TransformControl()

new TransformControl(scene): TransformControl

Parameters

scene: Scene

Returns

TransformControl

Overrides

ControlBase.constructor

Defined in

control/transformControl.ts:166

Properties

_interractorUbinds

protected _interractorUbinds: Function[]

Inherited from

ControlBase._interractorUbinds

Defined in

control/controlBase.ts:22


_isDragging

protected _isDragging: boolean

是否在拖动

Inherited from

ControlBase._isDragging

Defined in

control/controlBase.ts:21


_originCameraControlEnabled

protected _originCameraControlEnabled: boolean

相机控制器的初始启用状态

Inherited from

ControlBase._originCameraControlEnabled

Defined in

control/controlBase.ts:17


children

children: Node[] = []

子节点

Inherited from

ControlBase.children

Defined in

scene/Node.ts:44


classHierarchy

classHierarchy: ClassEnum[]

Deprecated

Inherited from

ControlBase.classHierarchy

Defined in

core/baseObject.ts:96


enabled

enabled: boolean = true

是否启用

Inherited from

ControlBase.enabled

Defined in

control/controlBase.ts:13


isLocalSpace

isLocalSpace: boolean = true

是否在本地空间下进行变换

Defined in

control/transformControl.ts:95


label

label: string

自定义标识

Inherited from

ControlBase.label

Defined in

core/baseObject.ts:104


layerMask

layerMask: number = 0

层级

Inherited from

ControlBase.layerMask

Defined in

scene/Node.ts:93


matrix

matrix: Mat4

本地矩阵

Inherited from

ControlBase.matrix

Defined in

scene/Node.ts:53


onAfterRender()

onAfterRender: (node) => void

渲染后的回调

Parameters

node: Node

Returns

void

Inherited from

ControlBase.onAfterRender

Defined in

scene/Node.ts:89


onBeforeRender()

onBeforeRender: (node) => void

渲染前的回调

Parameters

node: Node

Returns

void

Inherited from

ControlBase.onBeforeRender

Defined in

scene/Node.ts:85


parent?

optional parent: Node

父节点

Inherited from

ControlBase.parent

Defined in

scene/Node.ts:49


position

position: Vec3

位置

Inherited from

ControlBase.position

Defined in

scene/Node.ts:67


quaternion

quaternion: Quat

旋转

Inherited from

ControlBase.quaternion

Defined in

scene/Node.ts:77


ratioInViewMinSize

ratioInViewMinSize: number = 0.3

设置控制器的显示大小,跟视图最小边的比例

Defined in

control/transformControl.ts:115


rotationAbility

rotationAbility: boolean = false

是否可以旋转

Defined in

control/transformControl.ts:99


scaling

scaling: Vec3

缩放

Inherited from

ControlBase.scaling

Defined in

scene/Node.ts:72


scalingAbility

scalingAbility: boolean = false

是否可以缩放

Defined in

control/transformControl.ts:107


scene

scene: Scene

Inherited from

ControlBase.scene

Defined in

control/controlBase.ts:50


transitionAbility

transitionAbility: boolean = false

是否可以平移

Defined in

control/transformControl.ts:103


up

up: Vec3

上方向

Inherited from

ControlBase.up

Defined in

scene/Node.ts:62


userData

userData: any

用户自定义数据

Inherited from

ControlBase.userData

Defined in

core/baseObject.ts:100


uuid

uuid: number

唯一标识符

Inherited from

ControlBase.uuid

Defined in

core/baseObject.ts:92


visible

visible: boolean = true

是否可见

Inherited from

ControlBase.visible

Defined in

scene/Node.ts:39


worldMatrix

worldMatrix: Mat4

世界矩阵

Inherited from

ControlBase.worldMatrix

Defined in

scene/Node.ts:57

Accessors

_canUpdate

get protected _canUpdate(): boolean

Returns

boolean

Inherited from

ControlBase._canUpdate

Defined in

control/controlBase.ts:46


camera

get protected camera(): Camera

Returns

Camera

Inherited from

ControlBase.camera

Defined in

control/controlBase.ts:40


interactor

get protected interactor(): Interactor

Returns

Interactor

Inherited from

ControlBase.interactor

Defined in

control/controlBase.ts:43


mtime

get mtime(): number

Returns

number

Inherited from

ControlBase.mtime

Defined in

core/baseObject.ts:118


object

get object(): Node

控制的对象

set object(node): void

设置控制对象

Parameters

node: Node

Returns

Node

Inherited from

ControlBase.object

Defined in

control/controlBase.ts:30

Methods

_addHandlers()

protected _addHandlers(): void

Internal

添加事件监听

Returns

void

Overrides

ControlBase._addHandlers

Defined in

control/transformControl.ts:174


_onFrame()

protected _onFrame(): void

Internal

每一帧的回调

Returns

void

Overrides

ControlBase._onFrame

Defined in

control/transformControl.ts:212


_removeHandlers()

protected _removeHandlers(): void

Returns

void

Inherited from

ControlBase._removeHandlers

Defined in

control/controlBase.ts:73


add()

add(...nodes): void

添加子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

ControlBase.add

Defined in

scene/Node.ts:276


attach()

attach(target): void

Parameters

target: Node

Returns

void

Defined in

control/transformControl.ts:243


changed()

changed(): void

标记对象为已修改

Returns

void

Inherited from

ControlBase.changed

Defined in

core/baseObject.ts:128


detach()

detach(): void

Returns

void

Defined in

control/transformControl.ts:250


getRootNode()

getRootNode(): Node

Internal

获取根节点

Returns

Node

Inherited from

ControlBase.getRootNode

Defined in

scene/Node.ts:303


getRotation()

getRotation(): Number3

获取旋转信息

Returns

Number3

Inherited from

ControlBase.getRotation

Defined in

scene/Node.ts:132


getWorldDirection()

getWorldDirection(): Vec3

获取在世界空间下的朝向

Returns

Vec3

Inherited from

ControlBase.getWorldDirection

Defined in

scene/Node.ts:264


is()

is(t): boolean

Parameters

t: ClassEnum

Returns

boolean

Inherited from

ControlBase.is

Defined in

core/baseObject.ts:122


lookAt()

lookAt(target): void

看向某个点

Parameters

target: Vec3 = ...

Returns

void

Inherited from

ControlBase.lookAt

Defined in

scene/Node.ts:208


lookTo()

lookTo(direction): void

看向某个方向

Parameters

direction: Vec3

Returns

void

Inherited from

ControlBase.lookTo

Defined in

scene/Node.ts:220


onChanging()

onChanging(type, target): void

变化回调

Parameters

type: TransformMode

target: Node

Returns

void

Defined in

control/transformControl.ts:111


release()

release(): void

销毁该对象

Returns

void

Overrides

ControlBase.release

Defined in

control/transformControl.ts:256


remove()

remove(...nodes): void

移除子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

ControlBase.remove

Defined in

scene/Node.ts:290


rotate()

rotate(__namedParameters): void

绕自身坐标系xyz轴旋转指定弧度

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

ControlBase.rotate

Defined in

scene/Node.ts:189


rotateOnAxis()

rotateOnAxis(axis, radian): void

绕指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

ControlBase.rotateOnAxis

Defined in

scene/Node.ts:173


rotateOnWorldAxis()

rotateOnWorldAxis(axis, radian): void

绕世界坐标系指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

ControlBase.rotateOnWorldAxis

Defined in

scene/Node.ts:181


scale()

scale(__namedParameters): void

缩放节点

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

ControlBase.scale

Defined in

scene/Node.ts:198


setMatrix()

setMatrix(m): void

设置模型的矩阵

Parameters

m: Mat4

Returns

void

Inherited from

ControlBase.setMatrix

Defined in

scene/Node.ts:114


setRotation()

setRotation(x, y, z): void

设置旋转

Parameters

x: number

y: number = x

z: number = x

Returns

void

Inherited from

ControlBase.setRotation

Defined in

scene/Node.ts:142


translate()

translate(param0): void

延xyz轴移动

Parameters

param0

param0.dx?: number

param0.dy?: number

param0.dz?: number

Returns

void

Inherited from

ControlBase.translate

Defined in

scene/Node.ts:162


translateOnAxis()

translateOnAxis(axis, distance): TransformControl

延指定轴移动

Parameters

axis: Vec3

distance: number

Returns

TransformControl

Inherited from

ControlBase.translateOnAxis

Defined in

scene/Node.ts:152


traverse()

traverse(cb): void

遍历执行

Parameters

cb

Returns

void

Inherited from

ControlBase.traverse

Defined in

scene/Node.ts:123


updateMatrix()

updateMatrix(): void

更新本地矩阵

Returns

void

Inherited from

ControlBase.updateMatrix

Defined in

scene/Node.ts:228


updateWorldMatrix()

updateWorldMatrix(updateParant, updateChildren): void

更新世界矩阵,保存当前状态

Parameters

updateParant: boolean = false

updateChildren: boolean = true

Returns

void

Overrides

ControlBase.updateWorldMatrix

Defined in

control/transformControl.ts:267