ViewportDragInteraction.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 <AzCore/Math/Vector2.h>
  10. #include <LyShine/IDraw2d.h>
  11. //! Abstract base class for drag interactions in the UI Editor viewport window.
  12. class ViewportDragInteraction
  13. {
  14. public:
  15. enum class EndState
  16. {
  17. Inside,
  18. OutsideX, //!< Outside only on the X-axis
  19. OutsideY, //!< Outside only on the Y-axis
  20. OutsideXY, //!< Outside on both the X-axis and the Y-axis
  21. Canceled
  22. };
  23. public:
  24. ViewportDragInteraction(const AZ::Vector2& startMousePos);
  25. virtual ~ViewportDragInteraction();
  26. //! Update the interaction each time the mouse moves
  27. virtual void Update(const AZ::Vector2& mousePos) = 0;
  28. //! Render any display desired during the interaction
  29. virtual void Render(Draw2dHelper& draw2d);
  30. //! End the interaction
  31. virtual void EndInteraction(EndState endState);
  32. protected:
  33. AZ::Vector2 m_startMousePos;
  34. };