From 6e0394b7dc1a502edf557b3312bff056c4087531 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 7 Jul 2022 16:33:39 -0300 Subject: [PATCH] Fix using MoveMask command without visible selection Issue found testing #2796 without selection/without calling SelectTile command. --- src/app/commands/cmd_move_mask.cpp | 5 ++++- src/app/ui/editor/editor.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_move_mask.cpp b/src/app/commands/cmd_move_mask.cpp index efc101f59..a100e3b0f 100644 --- a/src/app/commands/cmd_move_mask.cpp +++ b/src/app/commands/cmd_move_mask.cpp @@ -66,7 +66,10 @@ bool MoveMaskCommand::onEnabled(Context* context) ContextFlags::HasActiveImage | ContextFlags::ActiveLayerIsEditable); else - return (current_editor ? true: false); + return (current_editor != nullptr) && + context->checkFlags(ContextFlags::HasActiveDocument | + ContextFlags::HasVisibleMask | + ContextFlags::HasActiveImage); } diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index 7b2523ab4..5c915d78a 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -2556,6 +2556,7 @@ void Editor::startSelectionTransformation(const gfx::Point& move, double angle) movingPixels->rotate(angle); } else if (StandbyState* standby = dynamic_cast(m_state.get())) { + ASSERT(m_document->isMaskVisible()); standby->startSelectionTransformation(this, move, angle); } }