arcRotateCameraMouseWheelInput.d.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import type { Nullable } from "../../types";
  2. import type { ArcRotateCamera } from "../../Cameras/arcRotateCamera";
  3. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  4. import type { IWheelEvent } from "../../Events/deviceInputEvents";
  5. /**
  6. * Manage the mouse wheel inputs to control an arc rotate camera.
  7. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  8. */
  9. export declare class ArcRotateCameraMouseWheelInput implements ICameraInput<ArcRotateCamera> {
  10. /**
  11. * Defines the camera the input is attached to.
  12. */
  13. camera: ArcRotateCamera;
  14. /**
  15. * Gets or Set the mouse wheel precision or how fast is the camera zooming.
  16. */
  17. wheelPrecision: number;
  18. /**
  19. * Gets or Set the boolean value that controls whether or not the mouse wheel
  20. * zooms to the location of the mouse pointer or not. The default is false.
  21. */
  22. zoomToMouseLocation: boolean;
  23. /**
  24. * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.
  25. * It defines the percentage of current camera.radius to use as delta when wheel is used.
  26. */
  27. wheelDeltaPercentage: number;
  28. /**
  29. * If set, this function will be used to set the radius delta that will be added to the current camera radius
  30. */
  31. customComputeDeltaFromMouseWheel: Nullable<(wheelDelta: number, input: ArcRotateCameraMouseWheelInput, event: IWheelEvent) => number>;
  32. private _wheel;
  33. private _observer;
  34. private _hitPlane;
  35. private _viewOffset;
  36. private _globalOffset;
  37. protected _computeDeltaFromMouseWheelLegacyEvent(mouseWheelDelta: number, radius: number): number;
  38. /**
  39. * Attach the input controls to a specific dom element to get the input from.
  40. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  41. */
  42. attachControl(noPreventDefault?: boolean): void;
  43. /**
  44. * Detach the current controls from the specified dom element.
  45. */
  46. detachControl(): void;
  47. /**
  48. * Update the current camera state depending on the inputs that have been used this frame.
  49. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  50. */
  51. checkInputs(): void;
  52. /**
  53. * Gets the class name of the current input.
  54. * @returns the class name
  55. */
  56. getClassName(): string;
  57. /**
  58. * Get the friendly name associated with the input class.
  59. * @returns the input friendly name
  60. */
  61. getSimpleName(): string;
  62. private _updateHitPlane;
  63. private _getPosition;
  64. private _inertialPanning;
  65. private _zoomToMouse;
  66. private _zeroIfClose;
  67. }