From d02e3e74d02b2df6ba2de22830cceff4707adb49 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 21 Feb 2017 00:10:49 +0100 Subject: [PATCH] ui: Fixed moving bundle nodes was not stored in undo stack --- src/lib/component/controller/GraphController.cpp | 8 ++++++++ src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp | 8 ++++++++ src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 99828ea4..7dd82dd4 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -1438,6 +1438,14 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const return it->second.get(); } + for (std::shared_ptr node : m_dummyNodes) + { + if (node->tokenId == tokenId) + { + return node.get(); + } + } + return nullptr; } diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp index cea84277..c293bc6d 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp @@ -4,6 +4,7 @@ #include #include "utility/messaging/type/MessageGraphNodeBundleSplit.h" +#include "utility/messaging/type/MessageGraphNodeMove.h" #include "component/view/GraphViewStyle.h" #include "qt/graphics/QtCountCircleItem.h" @@ -46,6 +47,13 @@ void QtGraphNodeBundle::onClick() ).dispatch(); } +void QtGraphNodeBundle::moved(const Vec2i& oldPosition) +{ + QtGraphNode::moved(oldPosition); + + MessageGraphNodeMove(m_tokenId, getPosition() - oldPosition).dispatch(); +} + void QtGraphNodeBundle::updateStyle() { GraphViewStyle::NodeStyle style; diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h index 69f8dae9..751efa55 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h @@ -18,7 +18,7 @@ public: virtual Id getTokenId() const; virtual void onClick(); - + virtual void moved(const Vec2i& oldPosition); virtual void updateStyle(); protected: