TransformControls.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. This class can be used to transform objects in 3D space by adapting a similar interaction model of DCC tools like Blender.
  15. Unlike other controls, it is not intended to transform the scene's camera.
  16. </p>
  17. <h2>Example</h2>
  18. <p>[example:misc_controls_transform misc / controls / transform ]</p>
  19. <h2>Constructor</h2>
  20. <h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement] )</h3>
  21. <p>
  22. <p>
  23. [page:Camera camera]: The camera of the rendered scene.
  24. </p>
  25. <p>
  26. [page:HTMLDOMElement domElement]: The HTML element used for event listeners.
  27. </p>
  28. <p>
  29. Creates a new instance of [name].
  30. </p>
  31. </p>
  32. <h2>Events</h2>
  33. <h3>change</h3>
  34. <p>
  35. Fires if any type of change (object or property change) is performed. Property changes
  36. are separate events you can add event listeners to. The event type is "propertyname-changed".
  37. </p>
  38. <h3>mouseDown</h3>
  39. <p>
  40. Fires if a pointer (mouse/touch) becomes active.
  41. </p>
  42. <h3>mouseUp</h3>
  43. <p>
  44. Fires if a pointer (mouse/touch) is no longer active.
  45. </p>
  46. <h3>objectChange</h3>
  47. <p>
  48. Fires if the controlled 3D object is changed.
  49. </p>
  50. <h2>Properties</h2>
  51. <p>See the base [page:Object3D] class for common properties.</p>
  52. <h3>[property:String axis]</h3>
  53. <p>
  54. The current transformation axis.
  55. </p>
  56. <h3>[property:Camera camera]</h3>
  57. <p>
  58. The camera of the rendered scene.
  59. </p>
  60. <h3>[property:HTMLDOMElement domElement]</h3>
  61. <p>
  62. The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will
  63. not set up new event listeners.
  64. </p>
  65. <h3>[property:Boolean dragging]</h3>
  66. <p>
  67. Whether or not dragging is currently performed. Read-only property.
  68. </p>
  69. <h3>[property:Boolean enabled]</h3>
  70. <p>
  71. Whether or not the controls are enabled.
  72. </p>
  73. <h3>[property:String mode]</h3>
  74. <p>
  75. The current transformation mode. Possible values are "translate", "rotate" and "scale". Default is *translate*.
  76. </p>
  77. <h3>[property:Object3D object]</h3>
  78. <p>
  79. The 3D object being controlled.
  80. </p>
  81. <h3>[property:Number rotationSnap]</h3>
  82. <p>
  83. By default, 3D objects are continously rotated. If you set this property to a numeric value (radians), you can define in which
  84. steps the 3D object should be rotated. Deault is *null*.
  85. </p>
  86. <h3>[property:Boolean showX]</h3>
  87. <p>
  88. Whether or not the x-axis helper should be visible. Default is *true*.
  89. </p>
  90. <h3>[property:Boolean showY]</h3>
  91. <p>
  92. Whether or not the y-axis helper should be visible. Default is *true*.
  93. </p>
  94. <h3>[property:Boolean showZ]</h3>
  95. <p>
  96. Whether or not the z-axis helper should be visible. Default is *true*.
  97. </p>
  98. <h3>[property:Number size]</h3>
  99. <p>
  100. The size of the helper UI (axes/planes). Default is *1*.
  101. </p>
  102. <h3>[property:String space]</h3>
  103. <p>
  104. Defines in which coordinate space transformations should be performed. Possible values are "world" and "local". Default is *world*.
  105. </p>
  106. <h3>[property:Number translationSnap]</h3>
  107. <p>
  108. By default, 3D objects are continously translated. If you set this property to a numeric value (world units), you can define in which
  109. steps the 3D object should be translated. Deault is *null*.
  110. </p>
  111. <h2>Methods</h2>
  112. <p>See the base [page:Object3D] class for common methods.</p>
  113. <h3>[method:TransformControls attach] ( [param:Object3D object] )</h3>
  114. <p>
  115. <p>
  116. [page:Object3D object]: The 3D object that should be transformed.
  117. </p>
  118. <p>
  119. Sets the 3D object that should be transformed and ensures the controls UI is visible.
  120. </p>
  121. </p>
  122. <h3>[method:TransformControls detach] ()</h3>
  123. <p>
  124. Removes the current 3D object from the controls and makes the helper UI is invisible.
  125. </p>
  126. <h3>[method:null dispose] ()</h3>
  127. <p>
  128. Should be called if the controls is no longer required.
  129. </p>
  130. <h3>[method:String getMode] ()</h3>
  131. <p>
  132. Returns the transformation mode.
  133. </p>
  134. <h3>[method:null setMode] ( [param:String mode] )</h3>
  135. <p>
  136. <p>
  137. [page:String mode]: The transformation mode.
  138. </p>
  139. <p>
  140. Sets the transformation mode.
  141. </p>
  142. </p>
  143. <h3>[method:null setRotationSnap] ( [param:Number rotationSnap] )</h3>
  144. <p>
  145. <p>
  146. [page:Number rotationSnap]: The rotation snap.
  147. </p>
  148. <p>
  149. Sets the rotation snap.
  150. </p>
  151. </p>
  152. <h3>[method:null setSize] ( [param:Number size] )</h3>
  153. <p>
  154. <p>
  155. [page:Number size]: The size of the helper UI.
  156. </p>
  157. <p>
  158. Sets the size of the helper UI.
  159. </p>
  160. </p>
  161. <h3>[method:null setSpace] ( [param:String space] )</h3>
  162. <p>
  163. <p>
  164. [page:String space]: The coordinate space in which transformations are applied.
  165. </p>
  166. <p>
  167. Sets the coordinate space in which transformations are applied.
  168. </p>
  169. </p>
  170. <h3>[method:null setTranslationSnap] ( [param:Number translationSnap] )</h3>
  171. <p>
  172. <p>
  173. [page:Number translationSnap]: The translation snap.
  174. </p>
  175. <p>
  176. Sets the translation snap.
  177. </p>
  178. </p>
  179. <h2>Source</h2>
  180. <p>
  181. [link:https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TransformControls.js examples/js/controls/TransformControls.js]
  182. </p>
  183. </body>
  184. </html>