Skip to content

Commit b406ed3

Browse files
committed
fix last version
1 parent 3d3abb2 commit b406ed3

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

flowchart-latest.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,11 @@
338338
symbol.shiftX((maxWidth - symbol.width)/2);
339339
}
340340

341-
for (i = 0, len = this.symbols.length; i < len; i++) {
342-
symbol = this.symbols[i];
343-
symbol.render();
344-
}
341+
this.start.render();
342+
// for (i = 0, len = this.symbols.length; i < len; i++) {
343+
// symbol = this.symbols[i];
344+
// symbol.render();
345+
// }
345346

346347
for (i = 0, len = this.symbols.length; i < len; i++) {
347348
symbol = this.symbols[i];
@@ -478,6 +479,8 @@
478479
this.next.shiftY(this.getY() + this.height + this.chart.options['line-length']);
479480
this.next.setX(bottomPoint.x - this.next.width/2);
480481
this.next.isPositioned = true;
482+
483+
this.next.render();
481484
}
482485
}
483486
};
@@ -849,6 +852,8 @@
849852
this.yes_symbol.shiftY(this.getY() + this.height + this.chart.options['line-length']);
850853
this.yes_symbol.setX(bottomPoint.x - this.yes_symbol.width/2);
851854
this.yes_symbol.isPositioned = true;
855+
856+
this.yes_symbol.render();
852857
}
853858
}
854859

@@ -857,9 +862,29 @@
857862
var leftPoint = this.no_symbol.getLeft();
858863

859864
if (!this.no_symbol.isPositioned) {
865+
860866
this.no_symbol.setY(rightPoint.y - this.no_symbol.height/2);
861867
this.no_symbol.shiftX(this.group.getBBox().x + this.width + this.chart.options['line-length']);
868+
869+
var hasSymbolUnder = false;
870+
var symb;
871+
for (var i = 0, len = this.chart.symbols.length; i < len; i++) {
872+
symb = this.chart.symbols[i];
873+
874+
var diff = Math.abs(symb.getCenter().x - this.no_symbol.getCenter().x);
875+
if (symb.getCenter().y > this.no_symbol.getCenter().y && diff <= this.no_symbol.width/2) {
876+
hasSymbolUnder = true;
877+
break;
878+
}
879+
}
880+
881+
if (hasSymbolUnder) {
882+
this.no_symbol.setX(symb.getX() + symb.width + this.chart.options['line-length']);
883+
}
884+
862885
this.no_symbol.isPositioned = true;
886+
887+
this.no_symbol.render();
863888
}
864889
}
865890
};

0 commit comments

Comments
 (0)