mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
PixelPaint: Restrict "crop to selection" to image boundaries
This commit is contained in:
parent
a610d9a3d1
commit
ae71d2b70e
Notes:
sideshowbarker
2024-07-17 20:49:41 +09:00
Author: https://github.com/marzipan14 🔰 Commit: https://github.com/SerenityOS/serenity/commit/ae71d2b70e4 Pull-request: https://github.com/SerenityOS/serenity/pull/11898 Issue: https://github.com/SerenityOS/serenity/issues/11864 Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/mustafaquraish ✅
@ -26,6 +26,7 @@
|
||||
#include <LibGUI/Toolbar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
||||
@ -467,7 +468,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
||||
// FIXME: disable this action if there is no selection
|
||||
if (editor->selection().is_empty())
|
||||
return;
|
||||
auto crop_rect = editor->selection().bounding_rect();
|
||||
auto crop_rect = editor->image().rect().intersected(editor->selection().bounding_rect());
|
||||
editor->image().crop(crop_rect);
|
||||
editor->selection().clear();
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user