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

PixelPaint: Add new selection moving modes

If you press "spacebar" while moving a selection, it will now move the
origin point of the selection; and if you press "control" it will move
it relatively to the center.
This commit is contained in:
Elliot Maisl 2021-06-17 00:00:23 +02:00 committed by Andreas Kling
parent e2215cc0e1
commit 90873781c1
2 changed files with 33 additions and 0 deletions

View file

@ -18,10 +18,19 @@ public:
virtual void on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;
virtual void on_keyup(GUI::KeyEvent&) override;
virtual void on_second_paint(Layer const&, GUI::PaintEvent&) override;
private:
enum class MovingMode {
MovingOrigin,
AroundCenter,
None,
};
bool m_selecting { false };
MovingMode m_moving_mode { MovingMode::None };
Gfx::IntPoint m_selection_start;
Gfx::IntPoint m_selection_end;
};