|
|
@ -10,6 +10,7 @@ import StraightEdge from './edges/StraightEdge' |
|
|
|
* @class Edge |
|
|
|
* |
|
|
|
* A edge connects two nodes |
|
|
|
* @param {string} [id] Id for the edge. optional |
|
|
|
* @param {Object} properties Object with options. Must contain |
|
|
|
* At least options from and to. |
|
|
|
* Available options: from (number), |
|
|
@ -22,7 +23,7 @@ import StraightEdge from './edges/StraightEdge' |
|
|
|
* example for the color |
|
|
|
*/ |
|
|
|
class Edge { |
|
|
|
constructor(options, body, globalOptions) { |
|
|
|
constructor(id, options, body, globalOptions) { |
|
|
|
if (body === undefined) { |
|
|
|
throw "No body provided"; |
|
|
|
} |
|
|
@ -31,7 +32,7 @@ class Edge { |
|
|
|
this.body = body; |
|
|
|
|
|
|
|
// initialize variables
|
|
|
|
this.id = undefined; |
|
|
|
this.id = id; |
|
|
|
this.fromId = undefined; |
|
|
|
this.toId = undefined; |
|
|
|
this.selected = false; |
|
|
@ -68,7 +69,6 @@ class Edge { |
|
|
|
|
|
|
|
Edge.parseOptions(this.options, options, true, this.globalOptions); |
|
|
|
|
|
|
|
if (options.id !== undefined) {this.id = options.id;} |
|
|
|
if (options.from !== undefined) {this.fromId = options.from;} |
|
|
|
if (options.to !== undefined) {this.toId = options.to;} |
|
|
|
if (options.title !== undefined) {this.title = options.title;} |
|
|
@ -229,17 +229,17 @@ class Edge { |
|
|
|
if (this.options.smooth.enabled === true) { |
|
|
|
if (this.options.smooth.type === 'dynamic') { |
|
|
|
dataChanged = true; |
|
|
|
this.edgeType = new BezierEdgeDynamic(this.options, this.body, this.labelModule); |
|
|
|
this.edgeType = new BezierEdgeDynamic(this.id, this.options, this.body, this.labelModule); |
|
|
|
} |
|
|
|
else if (this.options.smooth.type === 'cubicBezier') { |
|
|
|
this.edgeType = new CubicBezierEdge(this.options, this.body, this.labelModule); |
|
|
|
this.edgeType = new CubicBezierEdge(this.id, this.options, this.body, this.labelModule); |
|
|
|
} |
|
|
|
else { |
|
|
|
this.edgeType = new BezierEdgeStatic(this.options, this.body, this.labelModule); |
|
|
|
this.edgeType = new BezierEdgeStatic(this.id, this.options, this.body, this.labelModule); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
this.edgeType = new StraightEdge(this.options, this.body, this.labelModule); |
|
|
|
this.edgeType = new StraightEdge(this.id, this.options, this.body, this.labelModule); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|