diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-01-18 19:01:18 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-01 19:21:58 +0100 |
commit | 06e09cf4159fd1310eb86a7a623c859fa3547de6 (patch) | |
tree | d13a64ceb2ddcf2303f6585abda12b5b804720cd | |
parent | 2f5bbc68ed1bd4a1b864ae2d8267b5a79851d107 (diff) | |
download | serenity-06e09cf4159fd1310eb86a7a623c859fa3547de6.zip |
PixelPaint: Disable current tool when color picking using the Alt key
-rw-r--r-- | Userland/Applications/PixelPaint/ImageEditor.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index d62219b0e4..a361d2e3a7 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -391,6 +391,8 @@ void ImageEditor::mousedown_event(GUI::MouseEvent& event) void ImageEditor::doubleclick_event(GUI::MouseEvent& event) { + if (!m_active_tool || (event.alt() && !m_active_tool->is_overriding_alt())) + return; auto layer_event = m_active_layer ? event_adjusted_for_layer(event, *m_active_layer) : event; auto image_event = event_with_pan_and_scale_applied(event); Tool::MouseEvent tool_event(Tool::MouseEvent::Action::DoubleClick, layer_event, image_event, event); @@ -410,14 +412,14 @@ void ImageEditor::mousemove_event(GUI::MouseEvent& event) return; } - if (!m_active_tool) - return; - auto image_event = event_with_pan_and_scale_applied(event); if (on_image_mouse_position_change) { on_image_mouse_position_change(image_event.position()); } + if (!m_active_tool || (event.alt() && !m_active_tool->is_overriding_alt())) + return; + auto layer_event = m_active_layer ? event_adjusted_for_layer(event, *m_active_layer) : event; Tool::MouseEvent tool_event(Tool::MouseEvent::Action::MouseDown, layer_event, image_event, event); m_active_tool->on_mousemove(m_active_layer.ptr(), tool_event); @@ -433,7 +435,7 @@ void ImageEditor::mouseup_event(GUI::MouseEvent& event) return; } - if (!m_active_tool) + if (!m_active_tool || (event.alt() && !m_active_tool->is_overriding_alt())) return; auto layer_event = m_active_layer ? event_adjusted_for_layer(event, *m_active_layer) : event; auto image_event = event_with_pan_and_scale_applied(event); |