From 22edb3817174db37b4135530390b80ab33c28f0f Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Wed, 31 May 2017 09:10:52 +0200 Subject: [PATCH] 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() --- lib/network/modules/components/Edge.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/network/modules/components/Edge.js b/lib/network/modules/components/Edge.js index b94b0752..3e29041e 100644 --- a/lib/network/modules/components/Edge.js +++ b/lib/network/modules/components/Edge.js @@ -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); } } }