mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibGfx+PixelPaint: Add Point::end_point_for_aspect_ratio
method
Previously we only had `Point::end_point_for_square_aspect_ratio`, which was convenient for PixelPaint but assumed the aspect ratio was always fixed at 1. This patch replaces it with a new mthod that takes in an arbitrary aspect ratio and computes the end point based off that. There's some explicit casting going on in `Point.cpp` to ensure that the types line up, since we're templating Point based on `T`.`
This commit is contained in:
parent
5c244a7893
commit
f14c891ba5
4 changed files with 15 additions and 10 deletions
|
@ -96,7 +96,7 @@ void RectangleTool::on_mousemove(Layer* layer, MouseEvent& event)
|
|||
m_draw_mode = event.layer_event().alt() ? DrawMode::FromCenter : DrawMode::FromCorner;
|
||||
|
||||
if (event.layer_event().shift())
|
||||
m_rectangle_end_position = m_rectangle_start_position.end_point_for_square_aspect_ratio(event.layer_event().position());
|
||||
m_rectangle_end_position = m_rectangle_start_position.end_point_for_aspect_ratio(event.layer_event().position(), 1.0);
|
||||
else
|
||||
m_rectangle_end_position = event.layer_event().position();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue