flyCameraMouseInput.d.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  2. import type { FlyCamera } from "../../Cameras/flyCamera";
  3. /**
  4. * Listen to mouse events to control the camera.
  5. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  6. */
  7. export declare class FlyCameraMouseInput implements ICameraInput<FlyCamera> {
  8. /**
  9. * Defines the camera the input is attached to.
  10. */
  11. camera: FlyCamera;
  12. /**
  13. * Defines if touch is enabled. (Default is true.)
  14. */
  15. touchEnabled: boolean;
  16. /**
  17. * Defines the buttons associated with the input to handle camera rotation.
  18. */
  19. buttons: number[];
  20. /**
  21. * Assign buttons for Yaw control.
  22. */
  23. buttonsYaw: number[];
  24. /**
  25. * Assign buttons for Pitch control.
  26. */
  27. buttonsPitch: number[];
  28. /**
  29. * Assign buttons for Roll control.
  30. */
  31. buttonsRoll: number[];
  32. /**
  33. * Detect if any button is being pressed while mouse is moved.
  34. * -1 = Mouse locked.
  35. * 0 = Left button.
  36. * 1 = Middle Button.
  37. * 2 = Right Button.
  38. */
  39. activeButton: number;
  40. /**
  41. * Defines the pointer's angular sensibility, to control the camera rotation speed.
  42. * Higher values reduce its sensitivity.
  43. */
  44. angularSensibility: number;
  45. private _observer;
  46. private _rollObserver;
  47. private _previousPosition;
  48. private _noPreventDefault;
  49. private _element;
  50. /**
  51. * Listen to mouse events to control the camera.
  52. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  53. */
  54. constructor();
  55. /**
  56. * Attach the mouse control to the HTML DOM element.
  57. * @param noPreventDefault Defines whether events caught by the controls should call preventdefault().
  58. */
  59. attachControl(noPreventDefault?: boolean): void;
  60. /**
  61. * Detach the current controls from the specified dom element.
  62. */
  63. detachControl(): void;
  64. /**
  65. * Gets the class name of the current input.
  66. * @returns the class name.
  67. */
  68. getClassName(): string;
  69. /**
  70. * Get the friendly name associated with the input class.
  71. * @returns the input's friendly name.
  72. */
  73. getSimpleName(): string;
  74. private _pointerInput;
  75. private _onMouseMove;
  76. /**
  77. * Rotate camera by mouse offset.
  78. * @param offsetX
  79. * @param offsetY
  80. */
  81. private _rotateCamera;
  82. }