From 304928b2ec3a6c7c00ae821cffca133320bb4fa4 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 4 Apr 2016 13:58:54 +0200 Subject: [PATCH] Working in the events for the fictional nodes. --- pandora_console/include/constants.php | 1 + .../include/javascript/map/MapController.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index cc7579de92..9360cde783 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -502,4 +502,5 @@ define("FIT_HEIGH", 4); define("ITEM_TYPE_AGENT_NETWORKMAP", 0); define("ITEM_TYPE_MODULE_NETWORKMAP", 1); define("ITEM_TYPE_EDGE_NETWORKMAP", 2); +define("ITEM_TYPE_FICTIONAL_NODE", 3); ?> diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index 38c577fcbe..bc2beca8b1 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -1335,9 +1335,14 @@ MapController.prototype.key_is_pressed = function(key) { return self._keys_pressed[key]; } -MapController.prototype.events_for_nodes = function() { +MapController.prototype.events_for_nodes = function(id_node) { var self = this; + var selector = ".node"; + if (typeof(id_node) != "undefined") { + selector = "#node_" + id_node; + } + var node_menu = [ { title: 'Show details', @@ -1385,7 +1390,7 @@ MapController.prototype.events_for_nodes = function() { } ]; - d3.selectAll(".node") + d3.selectAll(selector) .on("mouseover", function(d) { self.select_node(d['graph_id'], "over"); }) @@ -1427,7 +1432,7 @@ MapController.prototype.events_for_nodes = function() { .on("drag", dragged) .on("dragend", dragended); - d3.selectAll(".draggable").call(drag); + d3.selectAll(selector).call(drag); /** @@ -1943,6 +1948,8 @@ MapController.prototype.add_fictional_node = function() { self.paint_nodes(); self.paint_items_minimap(); + + self.events_for_nodes(new_node['graph_id']); } MapController.prototype.get_last_graph_id = function() {