1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

PixelPaint: Fix tool preview positions after moving a layer

Previously the tool previews did not account for the position of
the layer, so would be drawn in the wrong location if the layer was
not at 0,0.
This commit is contained in:
MacDue 2022-08-20 18:09:20 +01:00 committed by Andreas Kling
parent 973771f8f4
commit 78813313f9
5 changed files with 11 additions and 0 deletions

View file

@ -123,6 +123,7 @@ void RectangleTool::on_second_paint(Layer const* layer, GUI::PaintEvent& event)
GUI::Painter painter(*m_editor);
painter.add_clip_rect(event.rect());
painter.translate(editor_layer_location(*layer));
auto start_position = editor_stroke_position(m_rectangle_start_position, m_thickness);
auto end_position = editor_stroke_position(m_rectangle_end_position, m_thickness);
draw_using(painter, start_position, end_position, AK::max(m_thickness * m_editor->scale(), 1), m_corner_radius * m_editor->scale());