#945 Divider lines for concurrency, full width when in a composit state

This commit is contained in:
Knut Sveidqvist
2019-10-06 15:53:34 +02:00
parent ce0b0fa0c8
commit b12791d3e0
2 changed files with 21 additions and 9 deletions

View File

@@ -36,8 +36,8 @@ export const drawDivider = g =>
.attr('x1', 10) .attr('x1', 10)
.attr('class', 'divider') .attr('class', 'divider')
.attr('x2', 20) .attr('x2', 20)
.attr('y1', 20) .attr('y1', 0)
.attr('y2', 20); .attr('y2', 0);
/** /**
* Draws a an end state as a black circle * Draws a an end state as a black circle

View File

@@ -109,9 +109,9 @@ const renderDoc = (doc, diagram, parentId) => {
if (parentId) if (parentId)
graph.setGraph({ graph.setGraph({
rankdir: 'LR', rankdir: 'LR',
multigraph: false, // multigraph: false,
compound: true, compound: true,
acyclicer: 'greedy', // acyclicer: 'greedy',
rankdir: 'LR', rankdir: 'LR',
ranker: 'tight-tree' ranker: 'tight-tree'
// isMultiGraph: false // isMultiGraph: false
@@ -142,6 +142,7 @@ const renderDoc = (doc, diagram, parentId) => {
console.warn('rendering doc 2', states, relations); console.warn('rendering doc 2', states, relations);
total = keys.length; total = keys.length;
let first = true;
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
const stateDef = states[keys[i]]; const stateDef = states[keys[i]];
console.warn('keys[i]', keys[i]); console.warn('keys[i]', keys[i]);
@@ -154,11 +155,22 @@ const renderDoc = (doc, diagram, parentId) => {
.attr('class', 'classGroup'); .attr('class', 'classGroup');
node = renderDoc(stateDef.doc, sub, stateDef.id); node = renderDoc(stateDef.doc, sub, stateDef.id);
if (first) {
first = false;
sub = addIdAndBox(sub, stateDef); sub = addIdAndBox(sub, stateDef);
let boxBounds = sub.node().getBBox(); let boxBounds = sub.node().getBBox();
node.width = boxBounds.width; node.width = boxBounds.width;
node.height = boxBounds.height + 10; node.height = boxBounds.height + 10;
transformationLog[stateDef.id] = { y: 35 }; transformationLog[stateDef.id] = { y: 35 };
console.warn('Here2');
} else {
console.warn('Here');
// sub = addIdAndBox(sub, stateDef);
let boxBounds = sub.node().getBBox();
node.width = boxBounds.width;
node.height = boxBounds.height;
// transformationLog[stateDef.id] = { y: 35 };
}
} else { } else {
node = drawState(diagram, stateDef, graph); node = drawState(diagram, stateDef, graph);
} }