1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:58:11 +00:00

PixelPaint: Make new pasted layer active immediately

Also clear any selection that existed before pasting. This feels a bit
more intuitive. We may also want to consider switching to the "Move"
tool automatically on paste, but I'm less sure about that.
This commit is contained in:
Andreas Kling 2021-06-14 18:01:46 +02:00
parent 765286f691
commit f54164e8ae

View file

@ -183,7 +183,9 @@ int main(int argc, char** argv)
auto layer = PixelPaint::Layer::try_create_with_bitmap(*image_editor.image(), *bitmap, "Pasted layer");
VERIFY(layer);
image_editor.image()->add_layer(layer.release_nonnull());
image_editor.image()->add_layer(*layer);
image_editor.set_active_layer(layer);
image_editor.selection().clear();
});
GUI::Clipboard::the().on_change = [&](auto& mime_type) {
paste_action->set_enabled(mime_type == "image/x-serenityos");