mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
PixelPaint: Show Guides on GuideTool activation
This adds on_tool_activation() to Tool which GuideTool can use to show guides, if they're hidden, when it's activated. Also show guides on mousedown since there's no use in drawing invisible guides.
This commit is contained in:
parent
3b3df40eb9
commit
1ad08ab7d6
6 changed files with 40 additions and 3 deletions
|
@ -57,6 +57,8 @@ void GuideTool::on_mousedown(Layer&, GUI::MouseEvent& mouse_event, GUI::MouseEve
|
|||
if (mouse_event.button() != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
||||
m_editor->set_guide_visibility(true);
|
||||
|
||||
RefPtr<Guide> new_guide;
|
||||
if (image_event.position().x() < 0 || image_event.position().x() > editor()->image().size().width()) {
|
||||
new_guide = Guide::construct(Guide::Orientation::Vertical, image_event.position().x());
|
||||
|
@ -129,6 +131,11 @@ void GuideTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_ev
|
|||
|
||||
void GuideTool::on_context_menu(Layer&, GUI::ContextMenuEvent& event)
|
||||
{
|
||||
if (!m_editor)
|
||||
return;
|
||||
|
||||
m_editor->set_guide_visibility(true);
|
||||
|
||||
if (!m_context_menu) {
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
m_context_menu->add_action(GUI::Action::create(
|
||||
|
@ -148,6 +155,12 @@ void GuideTool::on_context_menu(Layer&, GUI::ContextMenuEvent& event)
|
|||
m_context_menu->popup(event.screen_position());
|
||||
}
|
||||
|
||||
void GuideTool::on_tool_activation()
|
||||
{
|
||||
if (m_editor)
|
||||
m_editor->set_guide_visibility(true);
|
||||
}
|
||||
|
||||
GUI::Widget* GuideTool::get_properties_widget()
|
||||
{
|
||||
if (!m_properties_widget) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue