TrackballControls.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. <p>
  14. [name] is similar to [page:OrbitControls]. However, it does not maintain a constant camera [page:Object3D.up up] vector.
  15. That means if the camera orbits over the “north” and “south” poles, it does not flip to stay "right side up".
  16. </p>
  17. </p>
  18. <h2>Examples</h2>
  19. <p>[example:misc_controls_trackball misc / controls / trackball ]</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 when the camera has been transformed by the controls.
  37. </p>
  38. <h3>start</h3>
  39. <p>
  40. Fires when an interaction (e.g. touch) was initiated.
  41. </p>
  42. <h3>end</h3>
  43. <p>
  44. Fires when an interaction has finished.
  45. </p>
  46. <h2>Properties</h2>
  47. <h3>[property:HTMLDOMElement domElement]</h3>
  48. <p>
  49. The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will
  50. not set up new event listeners.
  51. </p>
  52. <h3>[property:Number dynamicDampingFactor]</h3>
  53. <p>
  54. Defines the intensity of damping. Only considered if [page:.staticMoving staticMoving] is set to *false*. Default is *0.2*.
  55. </p>
  56. <h3>[property:Boolean enabled]</h3>
  57. <p>
  58. Whether or not the controls are enabled.
  59. </p>
  60. <h3>[property:Array keys]</h3>
  61. <p>
  62. This array holds keycodes for controlling interactions.
  63. <ul>
  64. <li>When the first defined key is pressed, all mouse interactions (left, middle, right) performs orbiting.</li>
  65. <li>When the second defined key is pressed, all mouse interactions (left, middle, right) performs zooming.</li>
  66. <li>When the third defined key is pressed, all mouse interactions (left, middle, right) performs panning.</li>
  67. </ul>
  68. Default is *65, 83, 68* which represents A, S, D.
  69. </p>
  70. <h3>[property:Number maxDistance]</h3>
  71. <p>
  72. How far you can zoom out. Default is *Infinity*.
  73. </p>
  74. <h3>[property:Number minDistance]</h3>
  75. <p>
  76. How far you can zoom in. Default is *0*.
  77. </p>
  78. <h3>
  79. [property:Object mouseButtons]</h3>
  80. <p>
  81. This object contains references to the mouse actions used by the controls.
  82. <ul>
  83. <li>.LEFT is assigned with *THREE.MOUSE.ROTATE*</li>
  84. <li>.MIDDLE is assigned with *THREE.MOUSE.ZOOM*</li>
  85. <li>.RIGHT is assigned with *THREE.MOUSE.PAN*</li>
  86. </ul>
  87. </p>
  88. <h3>[property:Boolean noPan]</h3>
  89. <p>
  90. Whether or not panning is disabled. Default is *false*.
  91. </p>
  92. <h3>[property:Boolean noRotate]</h3>
  93. <p>
  94. Whether or not rotation is disabled. Default is *false*.
  95. </p>
  96. <h3>[property:Boolean noZoom]</h3>
  97. <p>
  98. Whether or not zooming is disabled. Default is *false*.
  99. </p>
  100. <h3>[property:Camera object]</h3>
  101. <p>
  102. The camera being controlled.
  103. </p>
  104. <h3>[property:Number panSpeed]</h3>
  105. <p>
  106. The zoom speed. Default is *0.3*.
  107. </p>
  108. <h3>[property:Number rotateSpeed]</h3>
  109. <p>
  110. The rotation speed. Default is *1.0*.
  111. </p>
  112. <h3>[property:Object screen]</h3>
  113. <p>
  114. Represents the properties of the screen. Automatically set when [page:.handleResize handleResize]() is called.
  115. <ul>
  116. <li>left: Represents the offset in pixels to the screen's left boundary.</li>
  117. <li>top: Represents the offset in pixels to the screen's top boundary.</li>
  118. <li>width: Represents the screen width in pixels.</li>
  119. <li>height: Represents the screen height in pixels.</li>
  120. </ul>
  121. </p>
  122. <h3>[property:Boolean staticMoving]</h3>
  123. <p>
  124. Whether or not damping is disabled. Default is *false*.
  125. </p>
  126. <h3>[property:Number zoomSpeed]</h3>
  127. <p>
  128. The zoom speed. Default is *1.2*.
  129. </p>
  130. <h2>Methods</h2>
  131. <h3>[method:null checkDistances] ()</h3>
  132. <p>
  133. Ensures the controls stay in the range [minDistance, maxDistance]. Called by [page:.update update]().
  134. </p>
  135. <h3>[method:null dispose] ()</h3>
  136. <p>
  137. Should be called if the controls is no longer required.
  138. </p>
  139. <h3>[method:null handleResize] ()</h3>
  140. <p>
  141. Should be called if the application window is resized.
  142. </p>
  143. <h3>[method:null panCamera] ()</h3>
  144. <p>
  145. Performs panning if necessary. Called by [page:.update update]().
  146. </p>
  147. <h3>[method:null reset] ()</h3>
  148. <p>
  149. Resets the controls to its initial state.
  150. </p>
  151. <h3>[method:null rotateCamera] ()</h3>
  152. <p>
  153. Rotates the camera if necessary. Called by [page:.update update]().
  154. </p>
  155. <h3>[method:null update] ()</h3>
  156. <p>
  157. Updates the controls. Usually called in the animation loop.
  158. </p>
  159. <h3>[method:null zoomCamera] ()</h3>
  160. <p>
  161. Performs zooming if necessary. Called by [page:.update update]().
  162. </p>
  163. <h2>Source</h2>
  164. <p>
  165. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/TrackballControls.js examples/jsm/controls/TrackballControls.js]
  166. </p>
  167. </body>
  168. </html>