TrackballControls.html 5.6 KB

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