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

PaintBrush: Allow canceling a line by pressing the Escape key

Sometimes you change your mind mid-line, and just want to get out of
the situation. You can now do that :^)
This commit is contained in:
Andreas Kling 2019-11-29 22:39:23 +01:00
parent 4e6cd541c9
commit b09ac26311
6 changed files with 21 additions and 1 deletions

View file

@ -58,6 +58,15 @@ void LineTool::on_second_paint(GPaintEvent& event)
painter.draw_line(m_line_start_position, m_line_end_position, m_widget->color_for(m_drawing_button), m_thickness);
}
void LineTool::on_keydown(GKeyEvent& event)
{
if (event.key() == Key_Escape && m_drawing_button != GMouseButton::None) {
m_drawing_button = GMouseButton::None;
m_widget->update();
event.accept();
}
}
void LineTool::on_contextmenu(GContextMenuEvent& event)
{
if (!m_context_menu) {