Use full adjacency also for mouseover nodes

This commit is contained in:
David Kaltschmidt
2015-09-10 15:38:03 +02:00
parent 7eb6b93ee9
commit b49e1f55d2
2 changed files with 10 additions and 10 deletions

View File

@@ -84,7 +84,7 @@ const NodesChart = React.createClass({
renderGraphNodes: function(nodes, scale) {
const hasSelectedNode = this.props.selectedNodeId && this.props.nodes.has(this.props.selectedNodeId);
const adjacency = hasSelectedNode ? AppStore.getAdjacentNodes() : null;
const adjacency = hasSelectedNode ? AppStore.getAdjacentNodes(this.props.selectedNodeId) : null;
return _.map(nodes, function(node) {
const highlighted = _.includes(this.props.highlightedNodeIds, node.id)
|| this.props.selectedNodeId === node.id;
@@ -215,7 +215,7 @@ const NodesChart = React.createClass({
return;
}
const adjacency = AppStore.getAdjacentNodes();
const adjacency = AppStore.getAdjacentNodes(props.selectedNodeId);
const adjacentLayoutNodes = [];
adjacency.forEach(function(adjacentId) {

View File

@@ -95,15 +95,15 @@ const AppStore = assign({}, EventEmitter.prototype, {
return activeTopologyOptions;
},
getAdjacentNodes: function() {
getAdjacentNodes: function(nodeId) {
adjacentNodes = adjacentNodes.clear();
if (nodes.has(selectedNodeId)) {
adjacentNodes = makeSet(nodes.get(selectedNodeId).get('adjacency'));
if (nodes.has(nodeId)) {
adjacentNodes = makeSet(nodes.get(nodeId).get('adjacency'));
// fill up set with reverse edges
nodes.forEach(function(node, nodeId) {
if (node.get('adjacency') && node.get('adjacency').includes(selectedNodeId)) {
adjacentNodes = adjacentNodes.add(nodeId);
nodes.forEach(function(node, id) {
if (node.get('adjacency') && node.get('adjacency').includes(nodeId)) {
adjacentNodes = adjacentNodes.add(id);
}
});
}
@@ -157,8 +157,8 @@ const AppStore = assign({}, EventEmitter.prototype, {
getHighlightedNodeIds: function() {
if (mouseOverNodeId) {
const adjacency = nodes.get(mouseOverNodeId).get('adjacency');
if (adjacency) {
const adjacency = this.getAdjacentNodes(mouseOverNodeId);
if (adjacency.size) {
return _.union(adjacency.toJS(), [mouseOverNodeId]);
}
}