diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index bc206c3621..2599f752f4 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -350,9 +350,9 @@ void ImageEditor::set_editor_color_to_color_at_mouse_position(GUI::MouseEvent co if (!color.alpha()) return; - if (event.button() == GUI::MouseButton::Primary) + if (event.buttons() & GUI::MouseButton::Primary) set_primary_color(color); - else if (event.button() == GUI::MouseButton::Secondary) + if (event.buttons() & GUI::MouseButton::Secondary) set_secondary_color(color); } diff --git a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp index fff91c5054..6c986efbf2 100644 --- a/Userland/Applications/PixelPaint/Tools/PickerTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PickerTool.cpp @@ -22,6 +22,24 @@ void PickerTool::on_mousedown(Layer* layer, MouseEvent& event) m_editor->set_editor_color_to_color_at_mouse_position(layer_event, m_sample_all_layers); } +void PickerTool::on_mouseup(Layer*, MouseEvent& event) +{ + auto layer_event = event.layer_event(); + if (layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary) + return; + m_editor->set_appended_status_info(DeprecatedString::empty()); +} + +void PickerTool::on_mousemove(Layer* layer, MouseEvent& event) +{ + if (!layer) + return; + auto layer_event = event.layer_event(); + if (!(layer_event.buttons() & GUI::MouseButton::Primary || layer_event.buttons() & GUI::MouseButton::Secondary)) + return; + m_editor->set_editor_color_to_color_at_mouse_position(layer_event, m_sample_all_layers); +} + GUI::Widget* PickerTool::get_properties_widget() { if (!m_properties_widget) { diff --git a/Userland/Applications/PixelPaint/Tools/PickerTool.h b/Userland/Applications/PixelPaint/Tools/PickerTool.h index 2b83017d4f..f45a8a404e 100644 --- a/Userland/Applications/PixelPaint/Tools/PickerTool.h +++ b/Userland/Applications/PixelPaint/Tools/PickerTool.h @@ -18,6 +18,8 @@ public: virtual ~PickerTool() override = default; virtual void on_mousedown(Layer*, MouseEvent&) override; + virtual void on_mouseup(Layer*, MouseEvent&) override; + virtual void on_mousemove(Layer*, MouseEvent&) override; virtual GUI::Widget* get_properties_widget() override; virtual Variant> cursor() override { return Gfx::StandardCursor::Eyedropper; }