1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

PixelPaint: Add delete selection behavior

The delete key can now be used to erase the pixels on the active layer
contained within the selection rectangle.

Closes #11861
This commit is contained in:
Olivier De Cannière 2022-01-14 15:18:47 +01:00 committed by Linus Groh
parent d3e7ec5a56
commit d3dfb957a6
3 changed files with 17 additions and 0 deletions

View file

@ -349,6 +349,11 @@ void ImageEditor::context_menu_event(GUI::ContextMenuEvent& event)
void ImageEditor::keydown_event(GUI::KeyEvent& event)
{
if (event.key() == Key_Delete && !selection().is_empty() && active_layer()) {
active_layer()->erase_selection(selection());
return;
}
if (m_active_tool)
m_active_tool->on_keydown(event);
}