Skip to content

Commit ebb73b6

Browse files
authored
Merge pull request #1 from adrai/master
update
2 parents 902b905 + 73394e7 commit ebb73b6

File tree

10 files changed

+50
-24
lines changed

10 files changed

+50
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[example](https://github.com/adrai/flowchart.js/blob/master/example/index.html)
66

77
#Requirements
8-
You will need [Raphaël](http://raphaeljs.com/)
8+
You will need [Raphaël](http://www.raphaeljs.com/)
99

1010
#Usage
1111

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"author": "adrai",
33
"name": "flowchart.js",
4-
"version": "1.6.1",
4+
"version": "1.6.3",
55
"main": "./index",
66
"private": false,
77
"engines": {

release/flowchart.js

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/flowchart.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/flowchart.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/flowchart.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

releasenotes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### v1.6.3
2+
3+
- Allow going to same symbol thanks to [nonylene](https://github.com/nonylene) [##83](https://github.com/adrai/flowchart.js/pull/#83)
4+
5+
### v1.6.2
6+
7+
- Fixed not calculate viewBox and size properly thanks to [jackycute](https://github.com/jackycute) [##74](https://github.com/adrai/flowchart.js/issues/#74)
8+
19
### v1.6.1
210

311
- Fixed lines are not included in the calculation of viewBox and size thanks to [jackycute](https://github.com/jackycute) [##72](https://github.com/adrai/flowchart.js/issues/#72) [##67](https://github.com/adrai/flowchart.js/issues/#67)

site

src/flowchart.chart.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ FlowChart.prototype.render = function() {
6060
len = 0,
6161
maxX = 0,
6262
maxY = 0,
63+
minX = 0,
64+
minY = 0,
6365
symbol,
6466
line;
6567

@@ -103,23 +105,38 @@ FlowChart.prototype.render = function() {
103105
maxY = y;
104106
}
105107
}
106-
108+
107109
for (i = 0, len = this.lines.length; i < len; i++) {
108110
line = this.lines[i].getBBox();
109-
var x = line.x2;
110-
var y = line.y2;
111-
if (x > maxX) {
112-
maxX = x;
111+
var x = line.x;
112+
var y = line.y;
113+
var x2 = line.x2;
114+
var y2 = line.y2;
115+
if (x < minX) {
116+
minX = x;
113117
}
114-
if (y > maxY) {
115-
maxY = y;
118+
if (y < minY) {
119+
minY = y;
120+
}
121+
if (x2 > maxX) {
122+
maxX = x2;
123+
}
124+
if (y2 > maxY) {
125+
maxY = y2;
116126
}
117127
}
118128

119129
var scale = this.options['scale'];
120130
var lineWidth = this.options['line-width'];
121-
this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));
122-
this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);
131+
132+
if (minX < 0) minX -= lineWidth;
133+
if (minY < 0) minY -= lineWidth;
134+
135+
var width = maxX + lineWidth - minX;
136+
var height = maxY + lineWidth - minY;
137+
138+
this.paper.setSize(width * scale, height * scale);
139+
this.paper.setViewBox(minX, minY, width, height, true);
123140
};
124141

125142
FlowChart.prototype.clean = function() {

src/flowchart.symbol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) {
239239
var isOnSameColumn = x === symbolX,
240240
isOnSameLine = y === symbolY,
241241
isUnder = y < symbolY,
242-
isUpper = y > symbolY,
242+
isUpper = y > symbolY || this === symbol,
243243
isLeft = x > symbolX,
244244
isRight = x < symbolX;
245245

0 commit comments

Comments
 (0)