freeCameraTouchInput.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  2. import type { FreeCamera } from "../../Cameras/freeCamera";
  3. /**
  4. * Manage the touch inputs to control the movement of a free camera.
  5. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  6. */
  7. export declare class FreeCameraTouchInput implements ICameraInput<FreeCamera> {
  8. /**
  9. * Define if mouse events can be treated as touch events
  10. */
  11. allowMouse: boolean;
  12. /**
  13. * Defines the camera the input is attached to.
  14. */
  15. camera: FreeCamera;
  16. /**
  17. * Defines the touch sensibility for rotation.
  18. * The lower the faster.
  19. */
  20. touchAngularSensibility: number;
  21. /**
  22. * Defines the touch sensibility for move.
  23. * The lower the faster.
  24. */
  25. touchMoveSensibility: number;
  26. /**
  27. * Swap touch actions so that one touch is used for rotation and multiple for movement
  28. */
  29. singleFingerRotate: boolean;
  30. private _offsetX;
  31. private _offsetY;
  32. private _pointerPressed;
  33. private _pointerInput?;
  34. private _observer;
  35. private _onLostFocus;
  36. private _isSafari;
  37. /**
  38. * Manage the touch inputs to control the movement of a free camera.
  39. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  40. * @param allowMouse Defines if mouse events can be treated as touch events
  41. */
  42. constructor(
  43. /**
  44. * Define if mouse events can be treated as touch events
  45. */
  46. allowMouse?: boolean);
  47. /**
  48. * Attach the input controls to a specific dom element to get the input from.
  49. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  50. */
  51. attachControl(noPreventDefault?: boolean): void;
  52. /**
  53. * Detach the current controls from the specified dom element.
  54. */
  55. detachControl(): void;
  56. /**
  57. * Update the current camera state depending on the inputs that have been used this frame.
  58. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  59. */
  60. checkInputs(): void;
  61. /**
  62. * Gets the class name of the current input.
  63. * @returns the class name
  64. */
  65. getClassName(): string;
  66. /**
  67. * Get the friendly name associated with the input class.
  68. * @returns the input friendly name
  69. */
  70. getSimpleName(): string;
  71. }