ui: GraphView can set active tokenId on node clicked
By now the graph displays the active node, without neighbours or anything, and clicking a node sets the active token id to the clicked nodes id. fortune cookie message = Be prepared to accept an exciting opportunity in the future.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
#include "component/controller/GraphController.h"
|
||||
|
||||
#include "component/view/graphElements/GraphEdge.h"
|
||||
#include "component/view/graphElements/GraphNode.h"
|
||||
#include "component/view/GraphView.h"
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
|
||||
GraphController::GraphController(std::shared_ptr<GraphAccess> graphAccess)
|
||||
: m_graphAccess(graphAccess)
|
||||
{
|
||||
@@ -15,6 +16,24 @@ GraphController::~GraphController()
|
||||
{
|
||||
}
|
||||
|
||||
void GraphController::handleMessage(MessageActivateToken* message)
|
||||
{
|
||||
GraphView* view = getView();
|
||||
if (view != NULL)
|
||||
{
|
||||
std::string name = m_graphAccess->getNameForNodeWithId(message->tokenId);
|
||||
|
||||
DummyNode node(name, message->tokenId, Vec2i(0,0));
|
||||
|
||||
std::vector<DummyNode> nodes;
|
||||
nodes.push_back(node);
|
||||
|
||||
std::vector<DummyEdge> edges;
|
||||
|
||||
view->rebuildGraph(nodes, edges);
|
||||
}
|
||||
}
|
||||
|
||||
GraphView* GraphController::getView()
|
||||
{
|
||||
return Controller::getView<GraphView>();
|
||||
|
||||
Reference in New Issue
Block a user