PixelPaint: Clear selection with escape key regardless of active tool

This makes ImageEditor responsible for clearing the active selection
when the escape key is pressed. If the active tool didn't act on the
Escape key (like some selection tools use this to indicate cancelling of
making a new selection), then ImageEditor will check for an active
selection and clear it.
This commit is contained in:
Timothy Slater 2022-11-16 08:51:14 -06:00 committed by Andreas Kling
parent d6bb110d89
commit dc5402f61e
Notes: sideshowbarker 2024-07-17 09:39:38 +09:00

View file

@ -423,6 +423,11 @@ void ImageEditor::keydown_event(GUI::KeyEvent& event)
if (m_active_tool && m_active_tool->on_keydown(event))
return;
if (event.key() == Key_Escape && !m_image->selection().is_empty()) {
m_image->selection().clear();
return;
}
event.ignore();
}