TrackballControls.html 5.2 KB

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