mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
PixelPaint: Add ability to draw rectangle from center
Essentially the same logic as the prior commit, but now for the `RectangleTool` class. Pressing `alt` lets you draw the rectangle with the starting position as the center.
This commit is contained in:
parent
1a3481f35b
commit
6ccdc018b4
2 changed files with 24 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Mustafa Quraish <mustafa@cs.toronto.edu>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -32,13 +33,19 @@ private:
|
|||
Gradient,
|
||||
};
|
||||
|
||||
void draw_using(GUI::Painter&, Gfx::IntRect const&);
|
||||
enum class DrawMode {
|
||||
FromCenter,
|
||||
FromCorner,
|
||||
};
|
||||
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position);
|
||||
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
|
||||
Gfx::IntPoint m_rectangle_start_position;
|
||||
Gfx::IntPoint m_rectangle_end_position;
|
||||
Mode m_mode { Mode::Outline };
|
||||
DrawMode m_draw_mode { DrawMode::FromCorner };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue