TrackballControls.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:EventDispatcher] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. [name] is similar to [page:OrbitControls]. However, it does not maintain a constant camera [page:Object3D.up up] vector.
  14. That means if the camera orbits over the “north” and “south” poles, it does not flip to stay "right side up".
  15. </p>
  16. <h2>Import</h2>
  17. <p>
  18. [name] is an add-on, and must be imported explicitly.
  19. See [link:#manual/introduction/Installation Installation / Addons].
  20. </p>
  21. <code>
  22. import { TrackballControls } from 'three/addons/controls/TrackballControls.js';
  23. </code>
  24. <h2>Examples</h2>
  25. <p>[example:misc_controls_trackball misc / controls / trackball ]</p>
  26. <h2>Constructor</h2>
  27. <h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement] )</h3>
  28. <p>
  29. [page:Camera camera]: The camera of the rendered scene.
  30. </p>
  31. <p>
  32. [page:HTMLDOMElement domElement]: The HTML element used for event listeners.
  33. </p>
  34. <p>
  35. Creates a new instance of [name].
  36. </p>
  37. <h2>Events</h2>
  38. <h3>change</h3>
  39. <p>
  40. Fires when the camera has been transformed by the controls.
  41. </p>
  42. <h3>start</h3>
  43. <p>
  44. Fires when an interaction (e.g. touch) was initiated.
  45. </p>
  46. <h3>end</h3>
  47. <p>
  48. Fires when an interaction has finished.
  49. </p>
  50. <h2>Properties</h2>
  51. <h3>[property:HTMLDOMElement domElement]</h3>
  52. <p>
  53. The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will
  54. not set up new event listeners.
  55. </p>
  56. <h3>[property:Number dynamicDampingFactor]</h3>
  57. <p>
  58. Defines the intensity of damping. Only considered if [page:.staticMoving staticMoving] is set to `false`. Default is `0.2`.
  59. </p>
  60. <h3>[property:Boolean enabled]</h3>
  61. <p>
  62. Whether or not the controls are enabled.
  63. </p>
  64. <h3>[property:Array keys]</h3>
  65. This array holds keycodes for controlling interactions.
  66. <ul>
  67. <li>When the first defined key is pressed, all mouse interactions (left, middle, right) performs orbiting.</li>
  68. <li>When the second defined key is pressed, all mouse interactions (left, middle, right) performs zooming.</li>
  69. <li>When the third defined key is pressed, all mouse interactions (left, middle, right) performs panning.</li>
  70. </ul>
  71. Default is *KeyA, KeyS, KeyD* which represents A, S, D.
  72. <h3>[property:Number maxDistance]</h3>
  73. <p>
  74. How far you can dolly out ( [page:PerspectiveCamera] only ). Default is `Infinity`.
  75. </p>
  76. <h3>[property:Number minDistance]</h3>
  77. <p>
  78. How far you can dolly in ( [page:PerspectiveCamera] only ). Default is *0*.
  79. </p>
  80. <h3>[property:Float maxZoom]</h3>
  81. <p>
  82. How far you can zoom out ( [page:OrthographicCamera] only ). Default is `Infinity`.
  83. </p>
  84. <h3>[property:Float minZoom]</h3>
  85. <p>
  86. How far you can zoom in ( [page:OrthographicCamera] only ). Default is *0*.
  87. </p>
  88. <h3>
  89. [property:Object mouseButtons]</h3>
  90. This object contains references to the mouse actions used by the controls.
  91. <ul>
  92. <li>.LEFT is assigned with `THREE.MOUSE.ROTATE`</li>
  93. <li>.MIDDLE is assigned with `THREE.MOUSE.ZOOM`</li>
  94. <li>.RIGHT is assigned with `THREE.MOUSE.PAN`</li>
  95. </ul>
  96. <h3>[property:Boolean noPan]</h3>
  97. <p>
  98. Whether or not panning is disabled. Default is `false`.
  99. </p>
  100. <h3>[property:Boolean noRotate]</h3>
  101. <p>
  102. Whether or not rotation is disabled. Default is `false`.
  103. </p>
  104. <h3>[property:Boolean noZoom]</h3>
  105. <p>
  106. Whether or not zooming is disabled. Default is `false`.
  107. </p>
  108. <h3>[property:Camera object]</h3>
  109. <p>
  110. The camera being controlled.
  111. </p>
  112. <h3>[property:Number panSpeed]</h3>
  113. <p>
  114. The pan speed. Default is `0.3`.
  115. </p>
  116. <h3>[property:Number rotateSpeed]</h3>
  117. <p>
  118. The rotation speed. Default is `1.0`.
  119. </p>
  120. <h3>[property:Object screen]</h3>
  121. Represents the properties of the screen. Automatically set when [page:.handleResize handleResize]() is called.
  122. <ul>
  123. <li>left: Represents the offset in pixels to the screen's left boundary.</li>
  124. <li>top: Represents the offset in pixels to the screen's top boundary.</li>
  125. <li>width: Represents the screen width in pixels.</li>
  126. <li>height: Represents the screen height in pixels.</li>
  127. </ul>
  128. <h3>[property:Boolean staticMoving]</h3>
  129. <p>
  130. Whether or not damping is disabled. Default is `false`.
  131. </p>
  132. <h3>[property:Vector3 target]</h3>
  133. <p>
  134. The focus point of the controls.
  135. </p>
  136. <h3>[property:Number zoomSpeed]</h3>
  137. <p>
  138. The zoom speed. Default is `1.2`.
  139. </p>
  140. <h2>Methods</h2>
  141. <h3>[method:undefined checkDistances] ()</h3>
  142. <p>
  143. Ensures the controls stay in the range [minDistance, maxDistance]. Called by [page:.update update]().
  144. </p>
  145. <h3>[method:undefined dispose] ()</h3>
  146. <p>
  147. Should be called if the controls is no longer required.
  148. </p>
  149. <h3>[method:undefined handleResize] ()</h3>
  150. <p>
  151. Should be called if the application window is resized.
  152. </p>
  153. <h3>[method:undefined panCamera] ()</h3>
  154. <p>
  155. Performs panning if necessary. Called by [page:.update update]().
  156. </p>
  157. <h3>[method:undefined reset] ()</h3>
  158. <p>
  159. Resets the controls to its initial state.
  160. </p>
  161. <h3>[method:undefined rotateCamera] ()</h3>
  162. <p>
  163. Rotates the camera if necessary. Called by [page:.update update]().
  164. </p>
  165. <h3>[method:undefined update] ()</h3>
  166. <p>
  167. Updates the controls. Usually called in the animation loop.
  168. </p>
  169. <h3>[method:undefined zoomCamera] ()</h3>
  170. <p>
  171. Performs zooming if necessary. Called by [page:.update update]().
  172. </p>
  173. <h2>Source</h2>
  174. <p>
  175. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/TrackballControls.js examples/jsm/controls/TrackballControls.js]
  176. </p>
  177. </body>
  178. </html>