mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
PixelPaint: Pass raw mouse event to Tools and wrap them all in a struct
This commit adds a Tool::MouseEvent struct, which contains events that may be needed by tools: layer-relative, image-relative and raw (editor- relative) event. The raw event is used by ZoomTool to properly pan the view. This fixes a bug which caused image to snap out of sight.
This commit is contained in:
parent
635130ef76
commit
0224dc2882
28 changed files with 186 additions and 127 deletions
|
@ -26,8 +26,9 @@ RectangleSelectTool::~RectangleSelectTool()
|
|||
{
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event)
|
||||
void RectangleSelectTool::on_mousedown(Layer&, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (image_event.button() != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
||||
|
@ -39,8 +40,9 @@ void RectangleSelectTool::on_mousedown(Layer&, GUI::MouseEvent&, GUI::MouseEvent
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event)
|
||||
void RectangleSelectTool::on_mousemove(Layer&, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (!m_selecting)
|
||||
return;
|
||||
|
||||
|
@ -56,8 +58,9 @@ void RectangleSelectTool::on_mousemove(Layer&, GUI::MouseEvent&, GUI::MouseEvent
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent& image_event)
|
||||
void RectangleSelectTool::on_mouseup(Layer&, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (!m_selecting || image_event.button() != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue