diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/dagre.iml b/.idea/dagre.iml new file mode 100644 index 00000000..24643cc3 --- /dev/null +++ b/.idea/dagre.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..5b5702d4 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..abc70213 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lib/layout.js b/lib/layout.js index c56c3bbb..e614b33a 100644 --- a/lib/layout.js +++ b/lib/layout.js @@ -94,8 +94,8 @@ function updateInputGraph(inputGraph, layoutGraph) { inputGraph.graph().height = layoutGraph.graph().height; } -var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], - graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, +var graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy", "clusterpaddingtop", "clusterpaddingbottom"], + graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb", clusterpaddingtop: 20, clusterpaddingbottom: 20 }, graphAttrs = ["acyclicer", "ranker", "rankdir", "align"], nodeNumAttrs = ["width", "height"], nodeDefaults = { width: 0, height: 0 }, diff --git a/lib/position/bk.js b/lib/position/bk.js index d3ebcebe..e3c8a872 100644 --- a/lib/position/bk.js +++ b/lib/position/bk.js @@ -265,7 +265,7 @@ function horizontalCompaction(g, layering, root, align, reverseSep) { function buildBlockGraph(g, layering, root, reverseSep) { var blockGraph = new Graph(), graphLabel = g.graph(), - sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep); + sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep, graphLabel.clusterpaddingtop, graphLabel.clusterpaddingbottom); _.forEach(layering, function(layer) { var u; @@ -376,7 +376,7 @@ function positionX(g) { return balance(xss, g.graph().align); } -function sep(nodeSep, edgeSep, reverseSep) { +function sep(nodeSep, edgeSep, reverseSep, clusterpaddingtop, clusterpaddingbottom) { return function(g, v, w) { var vLabel = g.node(v), wLabel = g.node(w), @@ -395,8 +395,11 @@ function sep(nodeSep, edgeSep, reverseSep) { } delta = 0; - sum += (vLabel.dummy ? edgeSep : nodeSep) / 2; - sum += (wLabel.dummy ? edgeSep : nodeSep) / 2; + var vPadding = vLabel.borderType === "borderRight" ? clusterpaddingbottom : clusterpaddingtop; + var wPadding = wLabel.borderType === "borderRight" ? clusterpaddingbottom : clusterpaddingtop; + + sum += (vLabel.dummy ? vLabel.dummy === "border" ? vPadding : edgeSep : nodeSep) / 2; + sum += (wLabel.dummy ? wLabel.dummy === "border" ? wPadding : edgeSep : nodeSep) / 2; sum += wLabel.width / 2; if (_.has(wLabel, "labelpos")) {