Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Commit 22edb38

Browse files
wimrijndersyotamberk
authored andcommitted
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()
1 parent ed8d6cb commit 22edb38

File tree

1 file changed

+5
-6
lines changed
  • lib/network/modules/components

1 file changed

+5
-6
lines changed

lib/network/modules/components/Edge.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,9 @@ class Edge {
528528
// set style
529529
var node1 = this.from;
530530
var node2 = this.to;
531-
var selected = (this.from.selected || this.to.selected || this.selected);
532531

533-
if (this.labelModule.differentState(selected, this.hover)) {
534-
this.labelModule.getTextSize(ctx, selected, this.hover);
532+
if (this.labelModule.differentState(this.selected, this.hover)) {
533+
this.labelModule.getTextSize(ctx, this.selected, this.hover);
535534
}
536535

537536
if (node1.id != node2.id) {
@@ -541,13 +540,13 @@ class Edge {
541540

542541
// if the label has to be rotated:
543542
if (this.options.font.align !== "horizontal") {
544-
this.labelModule.calculateLabelSize(ctx, selected, this.hover, point.x, point.y);
543+
this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y);
545544
ctx.translate(point.x, this.labelModule.size.yLine);
546545
this._rotateForLabelAlignment(ctx);
547546
}
548547

549548
// draw the label
550-
this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
549+
this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
551550
ctx.restore();
552551
}
553552
else {
@@ -564,7 +563,7 @@ class Edge {
564563
y = node1.y - node1.shape.height * 0.5;
565564
}
566565
point = this._pointOnCircle(x, y, radius, 0.125);
567-
this.labelModule.draw(ctx, point.x, point.y, selected, this.hover);
566+
this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover);
568567
}
569568
}
570569
}

0 commit comments

Comments
 (0)