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

PixelPaint: Add ability to draw squares and circles

Shift-key modifier for tools forces square aspect ratio.
It allows drawing squares with Rectangle Tool and circles
with Ellipse Tool.
This commit is contained in:
Zyper 2021-08-25 00:02:32 +02:00 committed by Brian Gianforcaro
parent 12e76bb3df
commit 344397557c
2 changed files with 10 additions and 2 deletions

View file

@ -89,7 +89,11 @@ void EllipseTool::on_mousemove(Layer*, MouseEvent& event)
m_draw_mode = event.layer_event().alt() ? DrawMode::FromCenter : DrawMode::FromCorner;
m_ellipse_end_position = event.layer_event().position();
if (event.layer_event().shift())
m_ellipse_end_position = m_ellipse_start_position.end_point_for_square_aspect_ratio(event.layer_event().position());
else
m_ellipse_end_position = event.layer_event().position();
m_editor->update();
}

View file

@ -95,7 +95,11 @@ void RectangleTool::on_mousemove(Layer* layer, MouseEvent& event)
m_draw_mode = event.layer_event().alt() ? DrawMode::FromCenter : DrawMode::FromCorner;
m_rectangle_end_position = event.layer_event().position();
if (event.layer_event().shift())
m_rectangle_end_position = m_rectangle_start_position.end_point_for_square_aspect_ratio(event.layer_event().position());
else
m_rectangle_end_position = event.layer_event().position();
m_editor->update();
}