Browse Source

Fix option handling label selection of edges (#3116)

* Fix selection nodes so that option selectConnectedEdges works as expected

* Using instance var select instead of local var in Edge.drawLabel()
gemini
wimrijnders 7 years ago
committed by yotamberk
parent
commit
22edb38171
1 changed files with 5 additions and 6 deletions
  1. +5
    -6
      lib/network/modules/components/Edge.js

+ 5
- 6
lib/network/modules/components/Edge.js View File

@ -528,10 +528,9 @@ class Edge {
// set style
var node1 = this.from;
var node2 = this.to;
var selected = (this.from.selected || this.to.selected || this.selected);
if (this.labelModule.differentState(selected, this.hover)) {
this.labelModule.getTextSize(ctx, selected, this.hover);
if (this.labelModule.differentState(this.selected, this.hover)) {
this.labelModule.getTextSize(ctx, this.selected, this.hover);
}
if (node1.id != node2.id) {
@ -541,13 +540,13 @@ class Edge {
// if the label has to be rotated:
if (this.options.font.align !== "horizontal") {
this.labelModule.calculateLabelSize(ctx, selected, this.hover, point.x, point.y);
this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y);
ctx.translate(point.x, this.labelModule.size.yLine);
this._rotateForLabelAlignment(ctx);
}
// draw the label
this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
ctx.restore();
}
else {
@ -564,7 +563,7 @@ class Edge {
y = node1.y - node1.shape.height * 0.5;
}
point = this._pointOnCircle(x, y, radius, 0.125);
this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
}
}
}

Loading…
Cancel
Save