Skip to content

Commit

Permalink
Merge pull request #1 from adrai/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
AsiaWang1991 committed Jun 19, 2016
2 parents 902b905 + 73394e7 commit ebb73b6
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[example](https://github.com/adrai/flowchart.js/blob/master/example/index.html)

#Requirements
You will need [Raphaël](http://raphaeljs.com/)
You will need [Raphaël](http://www.raphaeljs.com/)

#Usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "adrai",
"name": "flowchart.js",
"version": "1.6.1",
"version": "1.6.3",
"main": "./index",
"private": false,
"engines": {
Expand Down
15 changes: 8 additions & 7 deletions release/flowchart.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion release/flowchart.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions release/flowchart.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/flowchart.min.js.map

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### v1.6.3

- Allow going to same symbol thanks to [nonylene](https://github.com/nonylene) [##83](https://github.com/adrai/flowchart.js/pull/#83)

### v1.6.2

- Fixed not calculate viewBox and size properly thanks to [jackycute](https://github.com/jackycute) [##74](https://github.com/adrai/flowchart.js/issues/#74)

### v1.6.1

- 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)
Expand Down
2 changes: 1 addition & 1 deletion site
Submodule site updated 2 files
+8 −7 flowchart-latest.js
+50 −14 index.html
35 changes: 26 additions & 9 deletions src/flowchart.chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ FlowChart.prototype.render = function() {
len = 0,
maxX = 0,
maxY = 0,
minX = 0,
minY = 0,
symbol,
line;

Expand Down Expand Up @@ -103,23 +105,38 @@ FlowChart.prototype.render = function() {
maxY = y;
}
}

for (i = 0, len = this.lines.length; i < len; i++) {
line = this.lines[i].getBBox();
var x = line.x2;
var y = line.y2;
if (x > maxX) {
maxX = x;
var x = line.x;
var y = line.y;
var x2 = line.x2;
var y2 = line.y2;
if (x < minX) {
minX = x;
}
if (y > maxY) {
maxY = y;
if (y < minY) {
minY = y;
}
if (x2 > maxX) {
maxX = x2;
}
if (y2 > maxY) {
maxY = y2;
}
}

var scale = this.options['scale'];
var lineWidth = this.options['line-width'];
this.paper.setSize((maxX * scale) + (lineWidth * scale), (maxY * scale) + (lineWidth * scale));
this.paper.setViewBox(0, 0, maxX + lineWidth, maxY + lineWidth, true);

if (minX < 0) minX -= lineWidth;
if (minY < 0) minY -= lineWidth;

var width = maxX + lineWidth - minX;
var height = maxY + lineWidth - minY;

this.paper.setSize(width * scale, height * scale);
this.paper.setViewBox(minX, minY, width, height, true);
};

FlowChart.prototype.clean = function() {
Expand Down
2 changes: 1 addition & 1 deletion src/flowchart.symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) {
var isOnSameColumn = x === symbolX,
isOnSameLine = y === symbolY,
isUnder = y < symbolY,
isUpper = y > symbolY,
isUpper = y > symbolY || this === symbol,
isLeft = x > symbolX,
isRight = x < symbolX;

Expand Down

0 comments on commit ebb73b6

Please sign in to comment.