ViewportAddGuideInteraction.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "ViewportDragInteraction.h"
  10. #include "ViewportInteraction.h"
  11. #include <LyShine/Bus/UiTransform2dBus.h>
  12. class EditorWindow;
  13. //! Class used while an "Add guide" interaction is in progress in move or anchor mode
  14. class ViewportAddGuideInteraction
  15. : public ViewportDragInteraction
  16. {
  17. public:
  18. ViewportAddGuideInteraction(
  19. EditorWindow* editorWindow,
  20. AZ::EntityId canvasId,
  21. bool guideIsVertical,
  22. const AZ::Vector2& startDragMousePos);
  23. virtual ~ViewportAddGuideInteraction();
  24. // ViewportDragInteraction
  25. void Update(const AZ::Vector2& mousePos) override;
  26. void Render(Draw2dHelper& draw2d) override;
  27. void EndInteraction(EndState endState) override;
  28. // ~ViewportDragInteraction
  29. protected:
  30. // State that we will need every frame in the update is cached locally in this object
  31. EditorWindow* m_editorWindow;
  32. AZ::EntityId m_canvasId;
  33. bool m_guideIsVertical = false;
  34. bool m_isSnapping = false;
  35. // State that changes during the interaction
  36. AZ::Vector2 m_addingGuideAtPosition;
  37. AZ::Vector2 m_cursorViewportPos;
  38. };