1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

PixelPaint: Implement basic rectangular selection (preview only)

Using the rectangle select tool, you can now drag out a selection which
will be drawn in the form of "marching ants" :^)
This commit is contained in:
Andreas Kling 2021-06-14 17:22:45 +02:00
parent 4bd905de0e
commit 96b52f13e4
2 changed files with 82 additions and 4 deletions

View file

@ -19,6 +19,15 @@ public:
virtual void on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&) override;
virtual void on_second_paint(Layer const&, GUI::PaintEvent&) override;
private:
void draw_marching_ants(Gfx::Painter&, Gfx::IntRect const&) const;
bool m_selecting { false };
Gfx::IntPoint m_selection_start;
Gfx::IntPoint m_selection_end;
RefPtr<Core::Timer> m_marching_ants_timer;
int m_marching_ants_offset { 0 };
};
}