diff options
author | Tim Ledbetter <timledbetter@gmail.com> | 2023-01-12 22:29:53 +0000 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-01-13 15:45:28 +0100 |
commit | 569ef94228a786b302b3a3f05b2d65e825d9faf1 (patch) | |
tree | 2dfec40586c66c0e5f05c32047e92ed3d45e0e6c | |
parent | 037744e62a1877486cae40ec92a111237dce75f9 (diff) | |
download | serenity-569ef94228a786b302b3a3f05b2d65e825d9faf1.zip |
PixelPaint: Don't allow the move tool to resize to zero pixels
This prevents an error message appearing when we attempt to scale
a layer to zero pixels using the move tool.
-rw-r--r-- | Userland/Applications/PixelPaint/Tools/MoveTool.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index 8bc05c14ca..bbe9900a6d 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -93,7 +93,10 @@ void MoveTool::on_mousemove(Layer* layer, MouseEvent& event) auto aspect_ratio = m_layer_being_moved->size().aspect_ratio(); scaling_origin = opposite_corner.end_point_for_aspect_ratio(scaling_origin, aspect_ratio); } - m_new_layer_rect = Gfx::IntRect::from_two_points(scaling_origin, opposite_corner); + + auto scaled_rect = Gfx::IntRect::from_two_points(scaling_origin, opposite_corner); + if (!scaled_rect.is_empty()) + m_new_layer_rect = scaled_rect; } else { m_layer_being_moved->set_location(m_layer_origin.translated(delta)); } |