Forráskód Böngészése

PixelPaint: Restrict "crop to selection" to image boundaries

Mateusz Krajewski 3 éve
szülő
commit
ae71d2b70e
1 módosított fájl, 2 hozzáadás és 1 törlés
  1. 2 1
      Userland/Applications/PixelPaint/MainWidget.cpp

+ 2 - 1
Userland/Applications/PixelPaint/MainWidget.cpp

@@ -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();
         }));