Skip to content

Commit aa6cf63

Browse files
committed
Merge pull request #72 from hackmdio/master
Fixed lines are not included in the calculation of viewBox and Size
2 parents 8e1e3eb + a5f2119 commit aa6cf63

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/flowchart.chart.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ FlowChart.prototype.render = function() {
6060
len = 0,
6161
maxX = 0,
6262
maxY = 0,
63-
symbol;
63+
symbol,
64+
line;
6465

6566
for (i = 0, len = this.symbols.length; i < len; i++) {
6667
symbol = this.symbols[i];
@@ -102,6 +103,18 @@ FlowChart.prototype.render = function() {
102103
maxY = y;
103104
}
104105
}
106+
107+
for (i = 0, len = this.lines.length; i < len; i++) {
108+
line = this.lines[i].getBBox();
109+
var x = line.x2;
110+
var y = line.y2;
111+
if (x > maxX) {
112+
maxX = x;
113+
}
114+
if (y > maxY) {
115+
maxY = y;
116+
}
117+
}
105118

106119
var scale = this.options['scale'];
107120
var lineWidth = this.options['line-width'];

0 commit comments

Comments
 (0)