followCameraKeyboardMoveInput.d.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import type { ICameraInput } from "../../Cameras/cameraInputsManager";
  2. import type { FollowCamera } from "../../Cameras/followCamera";
  3. /**
  4. * Manage the keyboard inputs to control the movement of a follow camera.
  5. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
  6. */
  7. export declare class FollowCameraKeyboardMoveInput implements ICameraInput<FollowCamera> {
  8. /**
  9. * Defines the camera the input is attached to.
  10. */
  11. camera: FollowCamera;
  12. /**
  13. * Defines the list of key codes associated with the up action (increase heightOffset)
  14. */
  15. keysHeightOffsetIncr: number[];
  16. /**
  17. * Defines the list of key codes associated with the down action (decrease heightOffset)
  18. */
  19. keysHeightOffsetDecr: number[];
  20. /**
  21. * Defines whether the Alt modifier key is required to move up/down (alter heightOffset)
  22. */
  23. keysHeightOffsetModifierAlt: boolean;
  24. /**
  25. * Defines whether the Ctrl modifier key is required to move up/down (alter heightOffset)
  26. */
  27. keysHeightOffsetModifierCtrl: boolean;
  28. /**
  29. * Defines whether the Shift modifier key is required to move up/down (alter heightOffset)
  30. */
  31. keysHeightOffsetModifierShift: boolean;
  32. /**
  33. * Defines the list of key codes associated with the left action (increase rotationOffset)
  34. */
  35. keysRotationOffsetIncr: number[];
  36. /**
  37. * Defines the list of key codes associated with the right action (decrease rotationOffset)
  38. */
  39. keysRotationOffsetDecr: number[];
  40. /**
  41. * Defines whether the Alt modifier key is required to move left/right (alter rotationOffset)
  42. */
  43. keysRotationOffsetModifierAlt: boolean;
  44. /**
  45. * Defines whether the Ctrl modifier key is required to move left/right (alter rotationOffset)
  46. */
  47. keysRotationOffsetModifierCtrl: boolean;
  48. /**
  49. * Defines whether the Shift modifier key is required to move left/right (alter rotationOffset)
  50. */
  51. keysRotationOffsetModifierShift: boolean;
  52. /**
  53. * Defines the list of key codes associated with the zoom-in action (decrease radius)
  54. */
  55. keysRadiusIncr: number[];
  56. /**
  57. * Defines the list of key codes associated with the zoom-out action (increase radius)
  58. */
  59. keysRadiusDecr: number[];
  60. /**
  61. * Defines whether the Alt modifier key is required to zoom in/out (alter radius value)
  62. */
  63. keysRadiusModifierAlt: boolean;
  64. /**
  65. * Defines whether the Ctrl modifier key is required to zoom in/out (alter radius value)
  66. */
  67. keysRadiusModifierCtrl: boolean;
  68. /**
  69. * Defines whether the Shift modifier key is required to zoom in/out (alter radius value)
  70. */
  71. keysRadiusModifierShift: boolean;
  72. /**
  73. * Defines the rate of change of heightOffset.
  74. */
  75. heightSensibility: number;
  76. /**
  77. * Defines the rate of change of rotationOffset.
  78. */
  79. rotationSensibility: number;
  80. /**
  81. * Defines the rate of change of radius.
  82. */
  83. radiusSensibility: number;
  84. private _keys;
  85. private _ctrlPressed;
  86. private _altPressed;
  87. private _shiftPressed;
  88. private _onCanvasBlurObserver;
  89. private _onKeyboardObserver;
  90. private _engine;
  91. private _scene;
  92. /**
  93. * Attach the input controls to a specific dom element to get the input from.
  94. * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
  95. */
  96. attachControl(noPreventDefault?: boolean): void;
  97. /**
  98. * Detach the current controls from the specified dom element.
  99. */
  100. detachControl(): void;
  101. /**
  102. * Update the current camera state depending on the inputs that have been used this frame.
  103. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
  104. */
  105. checkInputs(): void;
  106. /**
  107. * Gets the class name of the current input.
  108. * @returns the class name
  109. */
  110. getClassName(): string;
  111. /**
  112. * Get the friendly name associated with the input class.
  113. * @returns the input friendly name
  114. */
  115. getSimpleName(): string;
  116. /**
  117. * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to
  118. * allow modification of the heightOffset value.
  119. * @returns true if modifier keys match
  120. */
  121. private _modifierHeightOffset;
  122. /**
  123. * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to
  124. * allow modification of the rotationOffset value.
  125. * @returns true if modifier keys match
  126. */
  127. private _modifierRotationOffset;
  128. /**
  129. * Check if the pressed modifier keys (Alt/Ctrl/Shift) match those configured to
  130. * allow modification of the radius value.
  131. * @returns true if modifier keys match
  132. */
  133. private _modifierRadius;
  134. }