From 92b071d0aa5de7eda5b489bbab7c434631e5b532 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Wed, 9 Apr 2025 08:16:27 +0530 Subject: [PATCH] Fix: Highlight condition in shape builder tool --- src/ui/tools/booleans-tool.cpp | 9 +++++++-- src/ui/tools/booleans-tool.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ui/tools/booleans-tool.cpp b/src/ui/tools/booleans-tool.cpp index 8ae1470abc..9453100aa2 100644 --- a/src/ui/tools/booleans-tool.cpp +++ b/src/ui/tools/booleans-tool.cpp @@ -177,6 +177,10 @@ bool InteractiveBooleansTool::root_handler(CanvasEvent const &event) set_cursor(add ? "cursor-union.svg" : "cursor-delete.svg"); update_status(); + if (last_cursor_position) { + boolean_builder->highlight(*last_cursor_position, add); + } + return ToolBase::root_handler(event); } @@ -222,6 +226,7 @@ bool InteractiveBooleansTool::event_button_press_handler(ButtonPressEvent const bool InteractiveBooleansTool::event_motion_handler(MotionEvent const &event) { + last_cursor_position = event.pos; bool add = should_add(event.modifiers); if (event.modifiers & GDK_BUTTON1_MASK) { @@ -230,9 +235,9 @@ bool InteractiveBooleansTool::event_motion_handler(MotionEvent const &event) } else { return boolean_builder->task_select(event.pos, add); } - } else { - return boolean_builder->highlight(event.pos, add); } + + return false; } bool InteractiveBooleansTool::event_button_release_handler(ButtonReleaseEvent const &event) diff --git a/src/ui/tools/booleans-tool.h b/src/ui/tools/booleans-tool.h index a1092ffa6a..fc9da3ef8c 100644 --- a/src/ui/tools/booleans-tool.h +++ b/src/ui/tools/booleans-tool.h @@ -63,6 +63,7 @@ private: sigc::scoped_connection _sel_changed; bool to_commit = false; + std::optional last_cursor_position; }; } // namespace Tools -- GitLab