From 9a0ef19b1241b60964fa1f8dc4bfe6eed2d18373 Mon Sep 17 00:00:00 2001 From: futpib Date: Thu, 15 Nov 2018 19:06:14 +0300 Subject: [PATCH] Tweak satellite positions --- components/graph/satellites-graph.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/components/graph/satellites-graph.js b/components/graph/satellites-graph.js index f3e94cd..2a4d8c7 100644 --- a/components/graph/satellites-graph.js +++ b/components/graph/satellites-graph.js @@ -21,10 +21,16 @@ const { const originalEdgeToSatelliteNode = edge => ({ id: `${edge.target}__satellite__${edge.id}`, - edge: edge.id, - source: edge.source, - target: edge.target, type: 'satellite', + + edge: edge.id, + edgeType: edge.type, + + source: edge.source, + sourceType: edge.source.type, + + target: edge.target, + targetType: edge.target.type, }); const originalEdgeAndSatelliteNodeToSatelliteEdge = (edge, satelliteNode) => { @@ -113,9 +119,17 @@ class GraphView extends React.Component { } static repositionSatellites(position, satelliteNodes) { + const offsetY = (satelliteNodes % 2) ? 0 : (satelliteSpread / 2); + satelliteNodes.forEach((satelliteNode, i) => { + if (satelliteNode.edgeType === 'monitorSource') { + satelliteNode.x = position.x; + satelliteNode.y = position.y; + return; + } satelliteNode.x = position.x; satelliteNode.y = position.y + + offsetY + (satelliteSpread * plusMinus(i)) + ((satelliteSpread / 2) * ((satelliteNodes.length + 1) % 2)); });