From ce84278f10e829fa33c2b50626a29f843452355f Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Thu, 29 Apr 2021 19:24:07 +0200 Subject: [PATCH] Better track of the order of the edge and removing debug code --- cypress/platform/knsv.html | 22 ++++++++++++---------- src/dagre-wrapper/edges.js | 34 ++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/cypress/platform/knsv.html b/cypress/platform/knsv.html index 52348338c..4e0261f3e 100644 --- a/cypress/platform/knsv.html +++ b/cypress/platform/knsv.html @@ -55,18 +55,20 @@ flowchart TD class T TestSub linkStyle 0,1 color:orange, stroke: orange; -
+
flowchart TB - subgraph S1 - sub1 -->sub2 - end - subgraph S2 - sub4 - end - S1 --> S2 - sub1 --> sub4 + + subgraph two + b1 + end + subgraph three + c2 + end + + three --> two + two --> c2
-
+
flowchart TB c1-->a2 subgraph one diff --git a/src/dagre-wrapper/edges.js b/src/dagre-wrapper/edges.js index c1138fe55..883586d57 100644 --- a/src/dagre-wrapper/edges.js +++ b/src/dagre-wrapper/edges.js @@ -1,6 +1,7 @@ import { log } from '../logger'; // eslint-disable-line import createLabel from './createLabel'; -import { line, curveBasis, curveLinear, select } from 'd3'; +// import { line, curveBasis, curveLinear, select } from 'd3'; +import { line, curveBasis, select } from 'd3'; import { getConfig } from '../config'; import utils from '../utils'; // import { calcLabelPosition } from '../utils'; @@ -299,7 +300,7 @@ const cutPathAtIntersect = (_points, boundryNode) => { let isInside = false; _points.forEach(point => { // const node = clusterDb[edge.toCluster].node; - log.warn('abc88 checking point', point, boundryNode); + log.info('abc88 checking point', point, boundryNode); // check if point is inside the boundry rect if (!outsideNode(boundryNode, point) && !isInside) { @@ -341,6 +342,7 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) const tail = graph.node(e.v); var head = graph.node(e.w); + log.info('abc88 InsertEdge: ', edge); if (head.intersect && tail.intersect) { points = points.slice(1, edge.points.length - 1); points.unshift(tail.intersect(points[0])); @@ -353,8 +355,8 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) points.push(head.intersect(points[points.length - 1])); } if (edge.toCluster) { - log.warn('to cluster abc88', clusterDb[edge.toCluster]); - points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node).reverse(); + log.info('to cluster abc88', clusterDb[edge.toCluster]); + points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node); // log.trace('edge', edge); // points = []; // let lastPointOutside; // = edge.points[0]; @@ -390,8 +392,8 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) } if (edge.fromCluster) { - log.warn('from cluster abc88', clusterDb[edge.fromCluster]); - points = cutPathAtIntersect(points, clusterDb[edge.fromCluster].node).reverse(); + log.info('from cluster abc88', clusterDb[edge.fromCluster]); + points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse(); // log.warn('edge', edge); // log.warn('from cluster', clusterDb[edge.fromCluster], points); // const updatedPoints = []; @@ -447,7 +449,7 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) } else { curve = curveBasis; } - curve = curveLinear; + // curve = curveLinear; const lineFunction = line() .x(function(d) { return d.x; @@ -489,15 +491,15 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) .attr('style', edge.style); // DEBUG code, adds a red circle at each edge coordinate - edge.points.forEach(point => { - elem - .append('circle') - .style('stroke', 'red') - .style('fill', 'red') - .attr('r', 1) - .attr('cx', point.x) - .attr('cy', point.y); - }); + // edge.points.forEach(point => { + // elem + // .append('circle') + // .style('stroke', 'red') + // .style('fill', 'red') + // .attr('r', 1) + // .attr('cx', point.x) + // .attr('cy', point.y); + // }); let url = ''; if (getConfig().state.arrowMarkerAbsolute) {