axisDragGizmo.d.ts 4.1 KB

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