diff --git a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp index 832765dc2d..a7a52e0bb2 100644 --- a/Userland/Applications/PixelPaint/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/RectangleSelectTool.cpp @@ -25,6 +25,8 @@ void RectangleSelectTool::on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent return; m_selecting = true; + m_editor->selection().begin_interactive_selection(); + m_selection_start = image_event.position(); m_selection_end = image_event.position(); m_editor->update(); @@ -45,6 +47,8 @@ void RectangleSelectTool::on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent& return; m_selecting = false; + m_editor->selection().end_interactive_selection(); + m_editor->update(); auto rect_in_image = Gfx::IntRect::from_two_points(m_selection_start, m_selection_end); diff --git a/Userland/Applications/PixelPaint/Selection.cpp b/Userland/Applications/PixelPaint/Selection.cpp index 6e645e9ddb..7bdef9d97d 100644 --- a/Userland/Applications/PixelPaint/Selection.cpp +++ b/Userland/Applications/PixelPaint/Selection.cpp @@ -23,7 +23,7 @@ Selection::Selection(ImageEditor& editor) m_marching_ants_timer = Core::Timer::create_repeating(80, [this] { ++m_marching_ants_offset; m_marching_ants_offset %= marching_ant_length; - if (!is_empty()) + if (!is_empty() || m_in_interactive_selection) m_editor.update(); }); m_marching_ants_timer->start(); diff --git a/Userland/Applications/PixelPaint/Selection.h b/Userland/Applications/PixelPaint/Selection.h index 9c73f4f29a..443e85d515 100644 --- a/Userland/Applications/PixelPaint/Selection.h +++ b/Userland/Applications/PixelPaint/Selection.h @@ -27,11 +27,15 @@ public: void draw_marching_ants(Gfx::Painter&, Gfx::IntRect const&) const; + void begin_interactive_selection() { m_in_interactive_selection = true; } + void end_interactive_selection() { m_in_interactive_selection = false; } + private: ImageEditor& m_editor; Gfx::IntRect m_rect; RefPtr m_marching_ants_timer; int m_marching_ants_offset { 0 }; + bool m_in_interactive_selection { false }; }; }