From e33791502f9c2cce5e47b99b0b5cf78570d6def4 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Tue, 28 Feb 2023 23:46:50 +0000 Subject: [PATCH] PixelPaint: Do not change layers when scaling with the move tool The move tool will no longer change the foreground layer if the cursor is currently hovering over a resize anchor. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 2 +- Userland/Applications/PixelPaint/Tools/MoveTool.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index 0d7ce8f339..dc774d68db 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -374,7 +374,7 @@ void ImageEditor::mousedown_event(GUI::MouseEvent& event) return; if (auto* tool = dynamic_cast(m_active_tool); tool && tool->layer_selection_mode() == MoveTool::LayerSelectionMode::ForegroundLayer) { - if (auto* foreground_layer = layer_at_editor_position(event.position())) + if (auto* foreground_layer = layer_at_editor_position(event.position()); foreground_layer && !tool->cursor_is_within_resize_anchor()) set_active_layer(foreground_layer); } diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.h b/Userland/Applications/PixelPaint/Tools/MoveTool.h index 456a7e17af..7452bcde24 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.h +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.h @@ -39,6 +39,7 @@ public: virtual Variant> cursor() override; virtual bool is_overriding_alt() override { return true; } LayerSelectionMode layer_selection_mode() const { return m_layer_selection_mode; } + bool cursor_is_within_resize_anchor() { return m_resize_anchor_location.has_value(); } private: static int resize_anchor_size(Gfx::IntRect layer_rect_in_frame_coordinates);