planeDragGizmo.d.ts 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import type { Observer } from "../Misc/observable";
  2. import { Observable } from "../Misc/observable";
  3. import type { Nullable } from "../types";
  4. import type { PointerInfo } from "../Events/pointerEvents";
  5. import { Vector3 } from "../Maths/math.vector";
  6. import { Color3 } from "../Maths/math.color";
  7. import { TransformNode } from "../Meshes/transformNode";
  8. import type { Node } from "../node";
  9. import { PointerDragBehavior } from "../Behaviors/Meshes/pointerDragBehavior";
  10. import type { IGizmo } from "./gizmo";
  11. import { Gizmo } from "./gizmo";
  12. import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer";
  13. import { StandardMaterial } from "../Materials/standardMaterial";
  14. import type { Scene } from "../scene";
  15. import type { PositionGizmo } from "./positionGizmo";
  16. /**
  17. * Interface for plane drag gizmo
  18. */
  19. export interface IPlaneDragGizmo extends IGizmo {
  20. /** Drag behavior responsible for the gizmos dragging interactions */
  21. dragBehavior: PointerDragBehavior;
  22. /** Drag distance in babylon units that the gizmo will snap to when dragged */
  23. snapDistance: number;
  24. /**
  25. * Event that fires each time the gizmo snaps to a new location.
  26. * * snapDistance is the change in distance
  27. */
  28. onSnapObservable: Observable<{
  29. snapDistance: number;
  30. }>;
  31. /** If the gizmo is enabled */
  32. isEnabled: boolean;
  33. /** Default material used to render when gizmo is not disabled or hovered */
  34. coloredMaterial: StandardMaterial;
  35. /** Material used to render when gizmo is hovered with mouse */
  36. hoverMaterial: StandardMaterial;
  37. /** Material used to render when gizmo is disabled. typically grey. */
  38. disableMaterial: StandardMaterial;
  39. }
  40. /**
  41. * Single plane drag gizmo
  42. */
  43. export declare class PlaneDragGizmo extends Gizmo implements IPlaneDragGizmo {
  44. /**
  45. * Drag behavior responsible for the gizmos dragging interactions
  46. */
  47. dragBehavior: PointerDragBehavior;
  48. protected _pointerObserver: Nullable<Observer<PointerInfo>>;
  49. /**
  50. * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
  51. */
  52. snapDistance: number;
  53. /**
  54. * Event that fires each time the gizmo snaps to a new location.
  55. * * snapDistance is the change in distance
  56. */
  57. onSnapObservable: Observable<{
  58. snapDistance: number;
  59. }>;
  60. protected _gizmoMesh: TransformNode;
  61. protected _coloredMaterial: StandardMaterial;
  62. protected _hoverMaterial: StandardMaterial;
  63. protected _disableMaterial: StandardMaterial;
  64. protected _isEnabled: boolean;
  65. protected _parent: Nullable<PositionGizmo>;
  66. protected _dragging: boolean;
  67. /** Default material used to render when gizmo is not disabled or hovered */
  68. get coloredMaterial(): StandardMaterial;
  69. /** Material used to render when gizmo is hovered with mouse*/
  70. get hoverMaterial(): StandardMaterial;
  71. /** Material used to render when gizmo is disabled. typically grey.*/
  72. get disableMaterial(): StandardMaterial;
  73. /**
  74. * @internal
  75. */
  76. static _CreatePlane(scene: Scene, material: StandardMaterial): TransformNode;
  77. /**
  78. * Creates a PlaneDragGizmo
  79. * @param dragPlaneNormal The axis normal to which the gizmo will be able to drag on
  80. * @param color The color of the gizmo
  81. * @param gizmoLayer The utility layer the gizmo will be added to
  82. * @param parent
  83. * @param hoverColor The color of the gizmo when hovering over and dragging
  84. * @param disableColor The Color of the gizmo when its disabled
  85. */
  86. constructor(dragPlaneNormal: Vector3, color?: Color3, gizmoLayer?: UtilityLayerRenderer, parent?: Nullable<PositionGizmo>, hoverColor?: Color3, disableColor?: Color3);
  87. protected _attachedNodeChanged(value: Nullable<Node>): void;
  88. /**
  89. * If the gizmo is enabled
  90. */
  91. set isEnabled(value: boolean);
  92. get isEnabled(): boolean;
  93. /**
  94. * Disposes of the gizmo
  95. */
  96. dispose(): void;
  97. }