Skip to content

Commit 0b6e613

Browse files
committed
new version
1 parent b406ed3 commit 0b6e613

File tree

1 file changed

+37
-23
lines changed

1 file changed

+37
-23
lines changed

flowchart-latest.js

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// flowchart, v1.1.2
1+
// flowchart, v1.1.3
22
// Copyright (c)2013 Adriano Raiano (adrai).
33
// Distributed under MIT license
44
// http://adrai.github.io/flowchart.js
@@ -111,15 +111,25 @@
111111
}
112112

113113
function _inherits(ctor, superCtor) {
114-
ctor.super_ = superCtor;
115-
ctor.prototype = Object.create(superCtor.prototype, {
116-
constructor: {
117-
value: ctor,
118-
enumerable: false,
119-
writable: true,
120-
configurable: true
121-
}
122-
});
114+
if (typeof(Object.create) === 'function') {
115+
// implementation from standard node.js 'util' module
116+
ctor.super_ = superCtor;
117+
ctor.prototype = Object.create(superCtor.prototype, {
118+
constructor: {
119+
value: ctor,
120+
enumerable: false,
121+
writable: true,
122+
configurable: true
123+
}
124+
});
125+
} else {
126+
// old school shim for old browsers
127+
ctor.super_ = superCtor;
128+
var TempCtor = function () {};
129+
TempCtor.prototype = superCtor.prototype;
130+
ctor.prototype = new TempCtor();
131+
ctor.prototype.constructor = ctor;
132+
}
123133
}
124134

125135
// move dependent functions to a container so that
@@ -866,21 +876,25 @@
866876
this.no_symbol.setY(rightPoint.y - this.no_symbol.height/2);
867877
this.no_symbol.shiftX(this.group.getBBox().x + this.width + this.chart.options['line-length']);
868878

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;
879+
var self = this;
880+
(function shift() {
881+
var hasSymbolUnder = false;
882+
var symb;
883+
for (var i = 0, len = self.chart.symbols.length; i < len; i++) {
884+
symb = self.chart.symbols[i];
885+
886+
var diff = Math.abs(symb.getCenter().x - self.no_symbol.getCenter().x);
887+
if (symb.getCenter().y > self.no_symbol.getCenter().y && diff <= self.no_symbol.width/2) {
888+
hasSymbolUnder = true;
889+
break;
890+
}
878891
}
879-
}
880892

881-
if (hasSymbolUnder) {
882-
this.no_symbol.setX(symb.getX() + symb.width + this.chart.options['line-length']);
883-
}
893+
if (hasSymbolUnder) {
894+
self.no_symbol.setX(symb.getX() + symb.width + self.chart.options['line-length']);
895+
shift();
896+
}
897+
})();
884898

885899
this.no_symbol.isPositioned = true;
886900

0 commit comments

Comments
 (0)