freeCameraMouseInput.d.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { Observable } from "../../Misc/observable";
  2. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  3. import type { FreeCamera } from "../../Cameras/freeCamera";
  4. /**
  5. * Manage the mouse inputs to control the movement of a free camera.
  6. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  7. */
  8. export declare class FreeCameraMouseInput implements ICameraInput<FreeCamera> {
  9. /**
  10. * Define if touch is enabled in the mouse input
  11. */
  12. touchEnabled: boolean;
  13. /**
  14. * Defines the camera the input is attached to.
  15. */
  16. camera: FreeCamera;
  17. /**
  18. * Defines the buttons associated with the input to handle camera move.
  19. */
  20. buttons: number[];
  21. /**
  22. * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.
  23. */
  24. angularSensibility: number;
  25. private _pointerInput;
  26. private _onMouseMove;
  27. private _observer;
  28. private _previousPosition;
  29. /**
  30. * Observable for when a pointer move event occurs containing the move offset
  31. */
  32. onPointerMovedObservable: Observable<{
  33. offsetX: number;
  34. offsetY: number;
  35. }>;
  36. /**
  37. * @internal
  38. * If the camera should be rotated automatically based on pointer movement
  39. */
  40. _allowCameraRotation: boolean;
  41. private _currentActiveButton;
  42. private _activePointerId;
  43. private _contextMenuBind;
  44. /**
  45. * Manage the mouse inputs to control the movement of a free camera.
  46. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  47. * @param touchEnabled Defines if touch is enabled or not
  48. */
  49. constructor(
  50. /**
  51. * Define if touch is enabled in the mouse input
  52. */
  53. touchEnabled?: boolean);
  54. /**
  55. * Attach the input controls to a specific dom element to get the input from.
  56. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  57. */
  58. attachControl(noPreventDefault?: boolean): void;
  59. /**
  60. * Called on JS contextmenu event.
  61. * Override this method to provide functionality.
  62. * @param evt the context menu event
  63. */
  64. onContextMenu(evt: PointerEvent): void;
  65. /**
  66. * Detach the current controls from the specified dom element.
  67. */
  68. detachControl(): void;
  69. /**
  70. * Gets the class name of the current input.
  71. * @returns the class name
  72. */
  73. getClassName(): string;
  74. /**
  75. * Get the friendly name associated with the input class.
  76. * @returns the input friendly name
  77. */
  78. getSimpleName(): string;
  79. }