Tweak satellite positions

This commit is contained in:
futpib 2018-11-15 19:06:14 +03:00
parent 736cf3e4e6
commit 9a0ef19b12

View File

@ -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));
});