abstractActionManager.d.ts 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import type { IDisposable } from "../scene";
  2. import type { IActionEvent } from "./actionEvent";
  3. import type { IAction } from "./action";
  4. import type { Nullable } from "../types";
  5. /**
  6. * Abstract class used to decouple action Manager from scene and meshes.
  7. * Do not instantiate.
  8. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  9. */
  10. export declare abstract class AbstractActionManager implements IDisposable {
  11. /** Gets the list of active triggers */
  12. static Triggers: {
  13. [key: string]: number;
  14. };
  15. /** Gets the cursor to use when hovering items */
  16. hoverCursor: string;
  17. /** Gets the list of actions */
  18. actions: IAction[];
  19. /**
  20. * Gets or sets a boolean indicating that the manager is recursive meaning that it can trigger action from children
  21. */
  22. isRecursive: boolean;
  23. /**
  24. * Releases all associated resources
  25. */
  26. abstract dispose(): void;
  27. /**
  28. * Does this action manager has pointer triggers
  29. */
  30. abstract get hasPointerTriggers(): boolean;
  31. /**
  32. * Does this action manager has pick triggers
  33. */
  34. abstract get hasPickTriggers(): boolean;
  35. /**
  36. * Process a specific trigger
  37. * @param trigger defines the trigger to process
  38. * @param evt defines the event details to be processed
  39. */
  40. abstract processTrigger(trigger: number, evt?: IActionEvent): void;
  41. /**
  42. * Does this action manager handles actions of any of the given triggers
  43. * @param triggers defines the triggers to be tested
  44. * @returns a boolean indicating whether one (or more) of the triggers is handled
  45. */
  46. abstract hasSpecificTriggers(triggers: number[]): boolean;
  47. /**
  48. * Does this action manager handles actions of any of the given triggers. This function takes two arguments for
  49. * speed.
  50. * @param triggerA defines the trigger to be tested
  51. * @param triggerB defines the trigger to be tested
  52. * @returns a boolean indicating whether one (or more) of the triggers is handled
  53. */
  54. abstract hasSpecificTriggers2(triggerA: number, triggerB: number): boolean;
  55. /**
  56. * Does this action manager handles actions of a given trigger
  57. * @param trigger defines the trigger to be tested
  58. * @param parameterPredicate defines an optional predicate to filter triggers by parameter
  59. * @returns whether the trigger is handled
  60. */
  61. abstract hasSpecificTrigger(trigger: number, parameterPredicate?: (parameter: any) => boolean): boolean;
  62. /**
  63. * Serialize this manager to a JSON object
  64. * @param name defines the property name to store this manager
  65. * @returns a JSON representation of this manager
  66. */
  67. abstract serialize(name: string): any;
  68. /**
  69. * Registers an action to this action manager
  70. * @param action defines the action to be registered
  71. * @returns the action amended (prepared) after registration
  72. */
  73. abstract registerAction(action: IAction): Nullable<IAction>;
  74. /**
  75. * Unregisters an action to this action manager
  76. * @param action defines the action to be unregistered
  77. * @returns a boolean indicating whether the action has been unregistered
  78. */
  79. abstract unregisterAction(action: IAction): Boolean;
  80. /**
  81. * Does exist one action manager with at least one trigger
  82. **/
  83. static get HasTriggers(): boolean;
  84. /**
  85. * Does exist one action manager with at least one pick trigger
  86. **/
  87. static get HasPickTriggers(): boolean;
  88. /**
  89. * Does exist one action manager that handles actions of a given trigger
  90. * @param trigger defines the trigger to be tested
  91. * @returns a boolean indicating whether the trigger is handled by at least one action manager
  92. **/
  93. static HasSpecificTrigger(trigger: number): boolean;
  94. }