CanvasHelpers.h 1.0 KB

123456789101112131415161718192021222324252627
  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 <AzToolsFramework/API/ToolsApplicationAPI.h>
  10. namespace CanvasHelpers
  11. {
  12. //! Begin an undoable canvas change
  13. AZStd::string BeginUndoableCanvasChange(AZ::EntityId canvasEntityId);
  14. //! End an undoable canvas change
  15. void EndUndoableCanvasChange(EditorWindow* editorWindow, const char* commandName, AZStd::string& canvasUndoXml);
  16. //! Given a point in canvas space return the point in viewport space
  17. AZ::Vector2 GetViewportPoint(AZ::EntityId canvasEntityId, const AZ::Vector2& canvasPoint);
  18. //! Given a point in viewport space convert to canvas space and snap. If snapToGrid is true it snaps to canvas snap distance, else to nearest pixel
  19. AZ::Vector2 GetSnappedCanvasPoint(AZ::EntityId canvasEntityId, const AZ::Vector2& viewportPoint, bool snapToGrid);
  20. } // namespace CanvasHelpers