diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 60fdedddc..ce1698493 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -195,52 +195,51 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) return true; } - // Transform selected pixels - if (document->isMaskVisible() && - m_decorator->getTransformHandles(editor)) { - TransformHandles* transfHandles = m_decorator->getTransformHandles(editor); - - // Get the handle covered by the mouse. - HandleType handle = transfHandles->getHandleAtPoint(editor, - msg->position(), - document->getTransformation()); - - if (handle != NoHandle) { - int x, y, opacity; - Image* image = location.image(&x, &y, &opacity); - if (image) { - if (!layer->isWritable()) { - Alert::show(PACKAGE "<isInsideSelection() && - currentTool->getInk(0)->isSelection() && - msg->left()) { - if (!layer->isWritable()) { - Alert::show(PACKAGE "<isEyedropper()) { - onMouseMove(editor, msg); + callEyedropper(editor); return true; } + if (clickedInk->isSelection()) { + // Transform selected pixels + if (document->isMaskVisible() && m_decorator->getTransformHandles(editor)) { + TransformHandles* transfHandles = m_decorator->getTransformHandles(editor); + + // Get the handle covered by the mouse. + HandleType handle = transfHandles->getHandleAtPoint(editor, + msg->position(), + document->getTransformation()); + + if (handle != NoHandle) { + int x, y, opacity; + Image* image = location.image(&x, &y, &opacity); + if (image) { + if (!layer->isWritable()) { + Alert::show(PACKAGE "<isInsideSelection() && msg->left()) { + if (!layer->isWritable()) { + Alert::show(PACKAGE "<left() || msg->right()) { tools::Ink* clickedInk = editor->getCurrentEditorInk(); - if (clickedInk->isEyedropper()) { - Command* eyedropper_cmd = - CommandsModule::instance()->getCommandByName(CommandId::Eyedropper); - bool fg = (static_cast(clickedInk)->target() == tools::PickInk::Fg); - - Params params; - params.set("target", fg ? "foreground": "background"); - - UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms); - } + if (clickedInk->isEyedropper()) + callEyedropper(editor); } editor->moveDrawingCursor(); @@ -561,6 +552,22 @@ void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleT } } +void StandbyState::callEyedropper(Editor* editor) +{ + tools::Ink* clickedInk = editor->getCurrentEditorInk(); + if (!clickedInk->isEyedropper()) + return; + + Command* eyedropper_cmd = + CommandsModule::instance()->getCommandByName(CommandId::Eyedropper); + bool fg = (static_cast(clickedInk)->target() == tools::PickInk::Fg); + + Params params; + params.set("target", fg ? "foreground": "background"); + + UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms); +} + ////////////////////////////////////////////////////////////////////// // Decorator diff --git a/src/app/ui/editor/standby_state.h b/src/app/ui/editor/standby_state.h index 1ad96e45b..23bfaee20 100644 --- a/src/app/ui/editor/standby_state.h +++ b/src/app/ui/editor/standby_state.h @@ -76,6 +76,7 @@ namespace app { private: void transformSelection(Editor* editor, ui::MouseMessage* msg, HandleType handle); + void callEyedropper(Editor* editor); Decorator* m_decorator; };