From 100f47a9b74e3094bba4782cbee8b3c767118cc8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 25 Jan 2017 14:35:28 -0500 Subject: [PATCH] fix(network): #2591 self reference edge should now appear in all cases (#2595) * self reference edge should now appear in all cases * add checks for shape width being NaN to get correct circle data * reorder resize arguments in Diamond, Dot and Star --- examples/network/basicUsage.html | 3 ++- lib/network/modules/components/edges/util/EdgeBase.js | 8 ++++---- lib/network/modules/components/nodes/shapes/Diamond.js | 2 +- lib/network/modules/components/nodes/shapes/Dot.js | 2 +- lib/network/modules/components/nodes/shapes/Star.js | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/network/basicUsage.html b/examples/network/basicUsage.html index 2b8b086c..f1f4e5f9 100644 --- a/examples/network/basicUsage.html +++ b/examples/network/basicUsage.html @@ -37,7 +37,8 @@ {from: 1, to: 3}, {from: 1, to: 2}, {from: 2, to: 4}, - {from: 2, to: 5} + {from: 2, to: 5}, + {from: 3, to: 3} ]); // create a network diff --git a/lib/network/modules/components/edges/util/EdgeBase.js b/lib/network/modules/components/edges/util/EdgeBase.js index a646cd4f..f8f608ea 100644 --- a/lib/network/modules/components/edges/util/EdgeBase.js +++ b/lib/network/modules/components/edges/util/EdgeBase.js @@ -57,7 +57,7 @@ class EdgeBase { this._line(ctx, values, viaNode, fromPoint, toPoint); } else { - let [x,y,radius] = this._getCircleData(ctx, values); + let [x,y,radius] = this._getCircleData(ctx); this._circle(ctx, values, x, y, radius); } } @@ -83,7 +83,7 @@ class EdgeBase { this._line(ctx, values, viaNode); } else { - let [x,y,radius] = this._getCircleData(ctx, values); + let [x,y,radius] = this._getCircleData(ctx); this._circle(ctx, values, x, y, radius); } @@ -98,7 +98,7 @@ class EdgeBase { ctx.dashedLine(this.from.x, this.from.y, this.to.x, this.to.y, pattern); } else { - let [x,y,radius] = this._getCircleData(ctx, values); + let [x,y,radius] = this._getCircleData(ctx); this._circle(ctx, values, x, y, radius); } // draw shadow if enabled @@ -331,7 +331,7 @@ class EdgeBase { returnValue = this._getDistanceToEdge(x1, y1, x2, y2, x3, y3, via) } else { - let [x,y,radius] = this._getCircleData(undefined, values); + let [x,y,radius] = this._getCircleData(undefined); let dx = x - x3; let dy = y - y3; returnValue = Math.abs(Math.sqrt(dx * dx + dy * dy) - radius); diff --git a/lib/network/modules/components/nodes/shapes/Diamond.js b/lib/network/modules/components/nodes/shapes/Diamond.js index 182c984d..ecda7ea3 100644 --- a/lib/network/modules/components/nodes/shapes/Diamond.js +++ b/lib/network/modules/components/nodes/shapes/Diamond.js @@ -7,7 +7,7 @@ class Diamond extends ShapeBase { super(options, body, labelModule) } - resize(ctx, values, selected = this.selected, hover = this.hover) { + resize(ctx, selected = this.selected, hover = this.hover, values) { this._resizeShape(selected, hover, values); } diff --git a/lib/network/modules/components/nodes/shapes/Dot.js b/lib/network/modules/components/nodes/shapes/Dot.js index 701600fc..6d054619 100644 --- a/lib/network/modules/components/nodes/shapes/Dot.js +++ b/lib/network/modules/components/nodes/shapes/Dot.js @@ -7,7 +7,7 @@ class Dot extends ShapeBase { super(options, body, labelModule) } - resize(ctx, values, selected = this.selected, hover = this.hover) { + resize(ctx, selected = this.selected, hover = this.hover, values) { this._resizeShape(selected, hover, values); } diff --git a/lib/network/modules/components/nodes/shapes/Star.js b/lib/network/modules/components/nodes/shapes/Star.js index 490de5ac..b99bc4e4 100644 --- a/lib/network/modules/components/nodes/shapes/Star.js +++ b/lib/network/modules/components/nodes/shapes/Star.js @@ -7,7 +7,7 @@ class Star extends ShapeBase { super(options, body, labelModule) } - resize(ctx, values, selected, hover) { + resize(ctx, selected, hover, values) { this._resizeShape(selected, hover, values); }