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

PixelPaint: Add snapping to the GuideTool

When holding Shift, the Guide snaps to a multiple of the specified
number from the properties widget.
This commit is contained in:
Tobias Christiansen 2021-08-07 14:13:46 +02:00 committed by Andreas Kling
parent 58cb668257
commit 4f5c69a04c
2 changed files with 42 additions and 0 deletions

View file

@ -23,13 +23,18 @@ public:
virtual void on_mouseup(Layer&, GUI::MouseEvent& layer_event, GUI::MouseEvent& image_event) override;
virtual void on_context_menu(Layer&, GUI::ContextMenuEvent&) override;
virtual GUI::Widget* get_properties_widget() override;
private:
RefPtr<Guide> closest_guide(Gfx::IntPoint const&);
RefPtr<GUI::Widget> m_properties_widget;
RefPtr<Guide> m_selected_guide;
RefPtr<Guide> m_context_menu_guide;
Gfx::IntPoint m_event_origin;
float m_guide_origin { 0 };
RefPtr<GUI::Menu> m_context_menu;
int m_snap_size { 10 };
};
}