TransformControls.html 5.5 KB

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