Skip to content

Commit 15a2007

Browse files
committed
Optimized a bit for left support adrai#26
1 parent 1c7939c commit 15a2007

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

component.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "flowchart",
3-
"version": "1.3.1",
4-
"main": "./release/flowchart-1.3.1.min.js",
3+
"version": "1.3.2",
4+
"main": "./release/flowchart-1.3.2.min.js",
55
"dependencies": {},
66
"ignore": [
77
"src/",

releasenotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v1.3.2
2+
3+
- Optimized a bit for left support [#26](https://github.com/adrai/flowchart.js/issues/26)
4+
15
### v1.3.1
26

37
- Added support for css class [#24](https://github.com/adrai/flowchart.js/pull/24)

src/flowchart.chart.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ FlowChart.prototype.render = function() {
6969

7070
for (i = 0, len = this.symbols.length; i < len; i++) {
7171
symbol = this.symbols[i];
72-
symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2);
73-
symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2);
72+
symbol.shiftX(this.options.x + (maxWidth - symbol.width)/2 + this.options['line-width']);
73+
symbol.shiftY(this.options.y + (maxHeight - symbol.height)/2 + this.options['line-width']);
7474
}
7575

7676
this.start.render();

src/flowchart.symbol.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,20 @@ Symbol.prototype.drawLineTo = function(symbol, text, origin) {
342342
this.bottomStart = true;
343343
symbol.topEnd = true;
344344
maxX = bottom.x + lineLength/2;
345+
} else if ((origin === 'left') && isOnSameColumn && isUpper) {
346+
var diffX = left.x - lineLength/2;
347+
if (symbolLeft.x < left.x) {
348+
diffX = symbolLeft.x - lineLength/2;
349+
}
350+
line = drawLine(this.chart, left, [
351+
{x: diffX, y: left.y},
352+
{x: diffX, y: symbolTop.y - lineLength/2},
353+
{x: symbolTop.x, y: symbolTop.y - lineLength/2},
354+
{x: symbolTop.x, y: symbolTop.y}
355+
], text);
356+
this.leftStart = true;
357+
symbol.topEnd = true;
358+
maxX = left.x;
345359
} else if ((origin === 'left')) {
346360
line = drawLine(this.chart, left, [
347361
{x: symbolTop.x + (left.x - symbolTop.x)/ 2, y: left.y},

0 commit comments

Comments
 (0)