mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
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:
parent
d6bb110d89
commit
dc5402f61e
Notes:
sideshowbarker
2024-07-17 09:39:38 +09:00
Author: https://github.com/tslater2006 Commit: https://github.com/SerenityOS/serenity/commit/dc5402f61e Pull-request: https://github.com/SerenityOS/serenity/pull/15678 Reviewed-by: https://github.com/awesomekling
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue