mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
PixelPaint: Make Layer passed to tools a pointer
Some tools (e.g. ZoomTool) doesn't need layer to work. This commit makes mouse events fire even if there is no layer. This fixes a bug that ZoomTool didn't work when there is no layers.
This commit is contained in:
parent
0224dc2882
commit
3ad9df1522
28 changed files with 202 additions and 136 deletions
|
@ -26,7 +26,7 @@ RectangleSelectTool::~RectangleSelectTool()
|
|||
{
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mousedown(Layer&, MouseEvent& event)
|
||||
void RectangleSelectTool::on_mousedown(Layer*, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (image_event.button() != GUI::MouseButton::Left)
|
||||
|
@ -40,7 +40,7 @@ void RectangleSelectTool::on_mousedown(Layer&, MouseEvent& event)
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mousemove(Layer&, MouseEvent& event)
|
||||
void RectangleSelectTool::on_mousemove(Layer*, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (!m_selecting)
|
||||
|
@ -58,7 +58,7 @@ void RectangleSelectTool::on_mousemove(Layer&, MouseEvent& event)
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_mouseup(Layer&, MouseEvent& event)
|
||||
void RectangleSelectTool::on_mouseup(Layer*, MouseEvent& event)
|
||||
{
|
||||
auto& image_event = event.image_event();
|
||||
if (!m_selecting || image_event.button() != GUI::MouseButton::Left)
|
||||
|
@ -124,7 +124,7 @@ void RectangleSelectTool::on_keyup(GUI::KeyEvent& key_event)
|
|||
m_moving_mode = MovingMode::None;
|
||||
}
|
||||
|
||||
void RectangleSelectTool::on_second_paint(Layer const&, GUI::PaintEvent& event)
|
||||
void RectangleSelectTool::on_second_paint(Layer const*, GUI::PaintEvent& event)
|
||||
{
|
||||
if (!m_selecting)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue