Skip to content

Commit ae71d2b

Browse files
marzipan14linusg
authored andcommitted
PixelPaint: Restrict "crop to selection" to image boundaries
1 parent a610d9a commit ae71d2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Userland/Applications/PixelPaint/MainWidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <LibGUI/Toolbar.h>
2727
#include <LibGUI/Window.h>
2828
#include <LibGfx/Bitmap.h>
29+
#include <LibGfx/Rect.h>
2930

3031
namespace PixelPaint {
3132

@@ -467,7 +468,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
467468
// FIXME: disable this action if there is no selection
468469
if (editor->selection().is_empty())
469470
return;
470-
auto crop_rect = editor->selection().bounding_rect();
471+
auto crop_rect = editor->image().rect().intersected(editor->selection().bounding_rect());
471472
editor->image().crop(crop_rect);
472473
editor->selection().clear();
473474
}));

0 commit comments

Comments
 (0)