From c7955337c2f02a7fed36c5d4ced8f11f4401c86e Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 29 Apr 2019 15:50:34 -0300 Subject: [PATCH] Disable Shift+click to draw straight lines when we are in SelectBoxState --- src/app/ui/editor/select_box_state.h | 3 +++ src/app/ui/editor/standby_state.cpp | 3 ++- src/app/ui/editor/standby_state.h | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/ui/editor/select_box_state.h b/src/app/ui/editor/select_box_state.h index dae95a87f..d04a78562 100644 --- a/src/app/ui/editor/select_box_state.h +++ b/src/app/ui/editor/select_box_state.h @@ -104,6 +104,9 @@ namespace app { virtual void postRenderDecorator(EditorPostRender* render) override; virtual void getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region) override; + // Disable Shift+click to draw straight lines with the Pencil tool + virtual bool canCheckStartDrawingStraightLine() { return false; } + private: typedef std::vector Rulers; diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 775ba3130..a3ba9d91b 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -639,7 +639,8 @@ bool StandbyState::checkStartDrawingStraightLine(Editor* editor, const ui::MouseMessage* msg) { // Start line preview with shift key - if (editor->startStraightLineWithFreehandTool(msg)) { + if (canCheckStartDrawingStraightLine() && + editor->startStraightLineWithFreehandTool(msg)) { tools::Pointer::Button pointerButton = (msg ? button_from_msg(msg): tools::Pointer::Left); diff --git a/src/app/ui/editor/standby_state.h b/src/app/ui/editor/standby_state.h index 22084ef97..5493187d2 100644 --- a/src/app/ui/editor/standby_state.h +++ b/src/app/ui/editor/standby_state.h @@ -48,12 +48,13 @@ namespace app { virtual Transformation getTransformation(Editor* editor); void startSelectionTransformation(Editor* editor, const gfx::Point& move, double angle); - + void startFlipTransformation(Editor* editor, doc::algorithm::FlipType flipType); - + protected: void callEyedropper(Editor* editor, const ui::MouseMessage* msg); bool checkStartDrawingStraightLine(Editor* editor, const ui::MouseMessage* msg); + virtual bool canCheckStartDrawingStraightLine() { return true; } class Decorator : public EditorDecorator { public: