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

PixelPaint: Make escape key clear selection for Wand Select Tool

This commit is contained in:
Timothy Slater 2022-09-02 19:05:50 -05:00 committed by Linus Groh
parent e81cf66784
commit 53e4cc16ff
2 changed files with 9 additions and 0 deletions

View file

@ -37,6 +37,14 @@ static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint
image.selection().merge(selection_mask, merge_mode);
}
void WandSelectTool::on_keydown(GUI::KeyEvent& key_event)
{
Tool::on_keydown(key_event);
if (key_event.key() == KeyCode::Key_Escape) {
m_editor->image().selection().clear();
}
}
void WandSelectTool::on_mousedown(Layer* layer, MouseEvent& event)
{
if (!layer)

View file

@ -22,6 +22,7 @@ public:
virtual ~WandSelectTool() = default;
virtual void on_mousedown(Layer*, MouseEvent& event) override;
virtual void on_keydown(GUI::KeyEvent&) override;
virtual GUI::Widget* get_properties_widget() override;
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }