From 7b3bc883f1d46e4e912ea435a150cc50920db60e Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Fri, 27 Jan 2023 22:00:09 +0000 Subject: [PATCH] PixelPaint: Set initial position correctly when using the move tool This fixes an issue, where single clicking in the corner of the image without moving the mouse would cause the layer to jump to the top left corner of the canvas. --- Userland/Applications/PixelPaint/Tools/MoveTool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index 086eab9e13..98c4d19c30 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2022, the SerenityOS developers. + * Copyright (c) 2022-2023, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -41,7 +41,7 @@ void MoveTool::on_mousedown(Layer* layer, MouseEvent& event) m_layer_being_moved = *layer; m_event_origin = image_event.position(); m_layer_origin = layer->location(); - m_new_layer_rect = m_editor->active_layer()->rect(); + m_new_layer_rect = m_editor->active_layer()->relative_rect(); } void MoveTool::on_mousemove(Layer* layer, MouseEvent& event)