1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

HackStudio: Allow moving widgets around using the CursorTool

You can now move the widgets around, either by themselves or in group
selections, by dragging them with the cursor tool. :^)
This commit is contained in:
Andreas Kling 2019-11-10 22:31:10 +01:00
parent f6576c4b7c
commit 567769eb2f
4 changed files with 79 additions and 8 deletions

View file

@ -1,6 +1,10 @@
#pragma once
#include "Tool.h"
#include <AK/HashMap.h>
#include <LibDraw/Point.h>
class GWidget;
class CursorTool final : public Tool {
public:
@ -15,4 +19,8 @@ private:
virtual void on_mousedown(GMouseEvent&) override;
virtual void on_mouseup(GMouseEvent&) override;
virtual void on_mousemove(GMouseEvent&) override;
Point m_drag_origin;
HashMap<GWidget*, Point> m_positions_before_drag;
bool m_dragging { false };
};