Browse Source

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
runTests
David Anderson 8 years ago
committed by Alexander Wunschik
parent
commit
100f47a9b7
5 changed files with 9 additions and 8 deletions
  1. +2
    -1
      examples/network/basicUsage.html
  2. +4
    -4
      lib/network/modules/components/edges/util/EdgeBase.js
  3. +1
    -1
      lib/network/modules/components/nodes/shapes/Diamond.js
  4. +1
    -1
      lib/network/modules/components/nodes/shapes/Dot.js
  5. +1
    -1
      lib/network/modules/components/nodes/shapes/Star.js

+ 2
- 1
examples/network/basicUsage.html View File

@ -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

+ 4
- 4
lib/network/modules/components/edges/util/EdgeBase.js View File

@ -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);

+ 1
- 1
lib/network/modules/components/nodes/shapes/Diamond.js View File

@ -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);
}

+ 1
- 1
lib/network/modules/components/nodes/shapes/Dot.js View File

@ -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);
}

+ 1
- 1
lib/network/modules/components/nodes/shapes/Star.js View File

@ -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);
}

Loading…
Cancel
Save