blob: 93631ff077fbf586186476451078a4e391cab6aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "Tool.h"
namespace PixelPaint {
class MoveTool final : public Tool {
public:
MoveTool();
virtual ~MoveTool() override;
virtual void on_mousedown(Layer*, MouseEvent&) override;
virtual void on_mousemove(Layer*, MouseEvent&) override;
virtual void on_mouseup(Layer*, MouseEvent&) override;
virtual void on_keydown(GUI::KeyEvent&) override;
virtual Gfx::StandardCursor cursor() override { return Gfx::StandardCursor::Move; }
private:
RefPtr<Layer> m_layer_being_moved;
Gfx::IntPoint m_event_origin;
Gfx::IntPoint m_layer_origin;
bool m_is_panning { false };
Gfx::FloatPoint m_saved_pan_origin;
};
}
|