diff --git a/src/app/tools/tool_loop_manager.cpp b/src/app/tools/tool_loop_manager.cpp index 9238342f1..e0949bb9c 100644 --- a/src/app/tools/tool_loop_manager.cpp +++ b/src/app/tools/tool_loop_manager.cpp @@ -203,6 +203,12 @@ void ToolLoopManager::movement(Pointer pointer) doLoopStep(false); } +void ToolLoopManager::disableMouseStabilizer() +{ + // Disable mouse stabilizer for the current ToolLoopManager + m_dynamics.stabilizer = false; +} + void ToolLoopManager::doLoopStep(bool lastStep) { // Original set of points to interwine (original user stroke, diff --git a/src/app/tools/tool_loop_manager.h b/src/app/tools/tool_loop_manager.h index 71be2fcfc..160915348 100644 --- a/src/app/tools/tool_loop_manager.h +++ b/src/app/tools/tool_loop_manager.h @@ -78,6 +78,10 @@ public: // Should be called each time the user moves the mouse inside the editor. void movement(Pointer pointer); + // Should be called when Shift+brush tool is used to disable stabilizer + // on the line preview + void disableMouseStabilizer(); + const Pointer& lastPointer() const { return m_lastPointer; } private: diff --git a/src/app/ui/editor/drawing_state.cpp b/src/app/ui/editor/drawing_state.cpp index 0fcdc1f6b..f6158a918 100644 --- a/src/app/ui/editor/drawing_state.cpp +++ b/src/app/ui/editor/drawing_state.cpp @@ -129,6 +129,12 @@ void DrawingState::initToolLoop(Editor* editor, editor->captureMouse(); } +void DrawingState::disableMouseStabilizer() +{ + ASSERT(m_toolLoopManager); + m_toolLoopManager->disableMouseStabilizer(); +} + void DrawingState::sendMovementToToolLoop(const tools::Pointer& pointer) { ASSERT(m_toolLoopManager); diff --git a/src/app/ui/editor/drawing_state.h b/src/app/ui/editor/drawing_state.h index e4bc87a74..c7587267e 100644 --- a/src/app/ui/editor/drawing_state.h +++ b/src/app/ui/editor/drawing_state.h @@ -60,6 +60,10 @@ namespace app { const ui::MouseMessage* msg, const tools::Pointer& pointer); + // Used to disable the current ToolLoopManager's stabilizer + // when Shift+brush tool is used to paint a line + void disableMouseStabilizer(); + // Used to send a movement() to the ToolLoopManager when // Shift+brush tool is used to paint a line. void sendMovementToToolLoop(const tools::Pointer& pointer); diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index f29361b65..003e75db7 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -696,6 +696,9 @@ bool StandbyState::checkStartDrawingStraightLine(Editor* editor, pointer ? pointer->type(): PointerType::Unknown, pointer ? pointer->pressure(): 0.0f)); if (drawingState) { + // Disable stabilizer so that it does not affect the line preview + drawingState->disableMouseStabilizer(); + drawingState->sendMovementToToolLoop( tools::Pointer( pointer ? pointer->point(): editor->screenToEditor(editor->mousePosInDisplay()),