|
@@ -10,33 +10,32 @@
|
|
<body>
|
|
<body>
|
|
[page:Object3D] →
|
|
[page:Object3D] →
|
|
|
|
|
|
- <h1>[name]</h1>
|
|
|
|
|
|
+ <h1>变换控制器([name])</h1>
|
|
|
|
|
|
<p class="desc">
|
|
<p class="desc">
|
|
- This class can be used to transform objects in 3D space by adapting a similar interaction model of DCC tools like Blender.
|
|
|
|
- Unlike other controls, it is not intended to transform the scene's camera.
|
|
|
|
|
|
+ 该类可提供一种类似于在数字内容创建工具(例如Blender)中对模型进行交互的方式,来在3D空间中变换物体。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Example</h2>
|
|
|
|
|
|
+ <h2>示例</h2>
|
|
|
|
|
|
<p>[example:misc_controls_transform misc / controls / transform ]</p>
|
|
<p>[example:misc_controls_transform misc / controls / transform ]</p>
|
|
|
|
|
|
- <h2>Constructor</h2>
|
|
|
|
|
|
+ <h2>构造函数</h2>
|
|
|
|
|
|
<h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement] )</h3>
|
|
<h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:Camera camera]: The camera of the rendered scene.
|
|
|
|
|
|
+ [page:Camera camera]: 被控制的摄像机。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- [page:HTMLDOMElement domElement]: The HTML element used for event listeners.
|
|
|
|
|
|
+ [page:HTMLDOMElement domElement]: 用于事件监听的HTML元素。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Creates a new instance of [name].
|
|
|
|
|
|
+ 创建一个新的 [name] 实例。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Events</h2>
|
|
|
|
|
|
+ <h2>事件</h2>
|
|
|
|
|
|
<h3>change</h3>
|
|
<h3>change</h3>
|
|
<p>
|
|
<p>
|
|
@@ -46,152 +45,151 @@
|
|
|
|
|
|
<h3>mouseDown</h3>
|
|
<h3>mouseDown</h3>
|
|
<p>
|
|
<p>
|
|
- Fires if a pointer (mouse/touch) becomes active.
|
|
|
|
|
|
+ 如果指针(鼠标/触摸)为活动状态则触发该事件。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>mouseUp</h3>
|
|
<h3>mouseUp</h3>
|
|
<p>
|
|
<p>
|
|
- Fires if a pointer (mouse/touch) is no longer active.
|
|
|
|
|
|
+ 如果指针(鼠标/触摸)不再为活动状态则触发该事件。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>objectChange</h3>
|
|
<h3>objectChange</h3>
|
|
<p>
|
|
<p>
|
|
- Fires if the controlled 3D object is changed.
|
|
|
|
|
|
+ 如果被控制的3D对象发生改变则触发该事件。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Properties</h2>
|
|
|
|
|
|
+ <h2>属性</h2>
|
|
|
|
|
|
- <p>See the base [page:Object3D] class for common properties.</p>
|
|
|
|
|
|
+ <p>共有属性请参见其基类[page:Object3D]。</p>
|
|
|
|
|
|
<h3>[property:String axis]</h3>
|
|
<h3>[property:String axis]</h3>
|
|
<p>
|
|
<p>
|
|
- The current transformation axis.
|
|
|
|
|
|
+ 当前变换轴。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Camera camera]</h3>
|
|
<h3>[property:Camera camera]</h3>
|
|
<p>
|
|
<p>
|
|
- The camera of the rendered scene.
|
|
|
|
|
|
+ 渲染场景的摄像机。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:HTMLDOMElement domElement]</h3>
|
|
<h3>[property:HTMLDOMElement domElement]</h3>
|
|
<p>
|
|
<p>
|
|
- The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will
|
|
|
|
- not set up new event listeners.
|
|
|
|
|
|
+ 该 HTMLDOMElement 用于监听鼠标/触摸事件,该属性必须在构造函数中传入。在此处改变它将不会设置新的事件监听。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean dragging]</h3>
|
|
<h3>[property:Boolean dragging]</h3>
|
|
<p>
|
|
<p>
|
|
- Whether or not dragging is currently performed. Read-only property.
|
|
|
|
|
|
+ 当前是否正在拖动。只读属性。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean enabled]</h3>
|
|
<h3>[property:Boolean enabled]</h3>
|
|
<p>
|
|
<p>
|
|
- Whether or not the controls are enabled.
|
|
|
|
|
|
+ 是否启用控制器。默认为*true*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:String mode]</h3>
|
|
<h3>[property:String mode]</h3>
|
|
<p>
|
|
<p>
|
|
- The current transformation mode. Possible values are "translate", "rotate" and "scale". Default is *translate*.
|
|
|
|
|
|
+ 当前的变换模式。可能的值包括"translate"、"rotate" 和 "scale"。默认为*translate*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Object3D object]</h3>
|
|
<h3>[property:Object3D object]</h3>
|
|
<p>
|
|
<p>
|
|
- The 3D object being controlled.
|
|
|
|
|
|
+ 正在被控制的3D对象。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Number rotationSnap]</h3>
|
|
<h3>[property:Number rotationSnap]</h3>
|
|
<p>
|
|
<p>
|
|
- By default, 3D objects are continously rotated. If you set this property to a numeric value (radians), you can define in which
|
|
|
|
- steps the 3D object should be rotated. Deault is *null*.
|
|
|
|
|
|
+ 默认情况下,3D对象是可以被连续旋转的。如果你将该值设为一个数值(弧度),则你将可以定义每次旋转3D对象时的步幅。
|
|
|
|
+ 默认为*null*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean showX]</h3>
|
|
<h3>[property:Boolean showX]</h3>
|
|
<p>
|
|
<p>
|
|
- Whether or not the x-axis helper should be visible. Default is *true*.
|
|
|
|
|
|
+ x轴手柄是否显示。默认为*true*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean showY]</h3>
|
|
<h3>[property:Boolean showY]</h3>
|
|
<p>
|
|
<p>
|
|
- Whether or not the y-axis helper should be visible. Default is *true*.
|
|
|
|
|
|
+ y轴手柄是否显示。默认为*true*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Boolean showZ]</h3>
|
|
<h3>[property:Boolean showZ]</h3>
|
|
<p>
|
|
<p>
|
|
- Whether or not the z-axis helper should be visible. Default is *true*.
|
|
|
|
|
|
+ z轴手柄是否显示。默认为*true*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Number size]</h3>
|
|
<h3>[property:Number size]</h3>
|
|
<p>
|
|
<p>
|
|
- The size of the helper UI (axes/planes). Default is *1*.
|
|
|
|
|
|
+ 手柄UI(轴/平面)的大小。默认为*1*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:String space]</h3>
|
|
<h3>[property:String space]</h3>
|
|
<p>
|
|
<p>
|
|
- Defines in which coordinate space transformations should be performed. Possible values are "world" and "local". Default is *world*.
|
|
|
|
|
|
+ 定义了在哪种空间坐标系中进行变换。可能的值有"world" 和 "local"。默认为*world*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Number translationSnap]</h3>
|
|
<h3>[property:Number translationSnap]</h3>
|
|
<p>
|
|
<p>
|
|
- By default, 3D objects are continously translated. If you set this property to a numeric value (world units), you can define in which
|
|
|
|
- steps the 3D object should be translated. Deault is *null*.
|
|
|
|
|
|
+ 默认情况下,3D对象是可以被连续平移的。如果你将该值设为一个数值(世界单位),则你将可以定义每次平移3D对象时的步幅。
|
|
|
|
+ 默认为*null*。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Methods</h2>
|
|
|
|
|
|
+ <h2>方法</h2>
|
|
|
|
|
|
- <p>See the base [page:Object3D] class for common methods.</p>
|
|
|
|
|
|
+ <p>共有方法请参见其基类[page:Object3D]。</p>
|
|
|
|
|
|
<h3>[method:TransformControls attach] ( [param:Object3D object] )</h3>
|
|
<h3>[method:TransformControls attach] ( [param:Object3D object] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:Object3D object]: The 3D object that should be transformed.
|
|
|
|
|
|
+ [page:Object3D object]: 应当变换的3D对象。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Sets the 3D object that should be transformed and ensures the controls UI is visible.
|
|
|
|
|
|
+ 设置应当变换的3D对象,并确保控制器UI是可见的。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:TransformControls detach] ()</h3>
|
|
<h3>[method:TransformControls detach] ()</h3>
|
|
<p>
|
|
<p>
|
|
- Removes the current 3D object from the controls and makes the helper UI is invisible.
|
|
|
|
|
|
+ 从控制器中移除当前3D对象,并确保控制器UI是不可见的。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null dispose] ()</h3>
|
|
<h3>[method:null dispose] ()</h3>
|
|
<p>
|
|
<p>
|
|
- Should be called if the controls is no longer required.
|
|
|
|
|
|
+ 若不再需要该控制器,则应当调用此函数。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:String getMode] ()</h3>
|
|
<h3>[method:String getMode] ()</h3>
|
|
<p>
|
|
<p>
|
|
- Returns the transformation mode.
|
|
|
|
|
|
+ 返回变换模式。
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null setMode] ( [param:String mode] )</h3>
|
|
<h3>[method:null setMode] ( [param:String mode] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:String mode]: The transformation mode.
|
|
|
|
|
|
+ [page:String mode]: 变换模式。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Sets the transformation mode.
|
|
|
|
|
|
+ 设置变换模式。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null setRotationSnap] ( [param:Number rotationSnap] )</h3>
|
|
<h3>[method:null setRotationSnap] ( [param:Number rotationSnap] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:Number rotationSnap]: The rotation snap.
|
|
|
|
|
|
+ [page:Number rotationSnap]: 旋转捕捉步幅。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Sets the rotation snap.
|
|
|
|
|
|
+ 设置旋转捕捉。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[method:null setSize] ( [param:Number size] )</h3>
|
|
<h3>[method:null setSize] ( [param:Number size] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:Number size]: The size of the helper UI.
|
|
|
|
|
|
+ [page:Number size]: 手柄UI的大小。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Sets the size of the helper UI.
|
|
|
|
|
|
+ 设置手柄UI的大小。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
@@ -208,14 +206,14 @@
|
|
<h3>[method:null setTranslationSnap] ( [param:Number translationSnap] )</h3>
|
|
<h3>[method:null setTranslationSnap] ( [param:Number translationSnap] )</h3>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
<p>
|
|
- [page:Number translationSnap]: The translation snap.
|
|
|
|
|
|
+ [page:Number translationSnap]: 平移捕捉步幅。
|
|
</p>
|
|
</p>
|
|
<p>
|
|
<p>
|
|
- Sets the translation snap.
|
|
|
|
|
|
+ 设置平移捕捉。
|
|
</p>
|
|
</p>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h2>Source</h2>
|
|
|
|
|
|
+ <h2>源代码</h2>
|
|
|
|
|
|
<p>
|
|
<p>
|
|
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TransformControls.js examples/js/controls/TransformControls.js]
|
|
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TransformControls.js examples/js/controls/TransformControls.js]
|