Nils Schneider пре 8 година
родитељ
комит
8b10d2ec10
1 измењених фајлова са 4 додато и 6 уклоњено
  1. 4 6
      lib/forcegraph.js

+ 4 - 6
lib/forcegraph.js

@@ -381,7 +381,6 @@ define(["d3"], function (d3) {
       })
 
       ctx.fillStyle = clientColor
-      ctx.globalCompositeOperation = "overlay"
       ctx.fill()
       ctx.restore()
 
@@ -395,13 +394,12 @@ define(["d3"], function (d3) {
         ctx.globalCompositeOperation = "lighten"
         ctx.fillStyle = highlightColor
 
+        ctx.beginPath()
         highlightedNodes.forEach(function (d) {
-          ctx.beginPath()
           ctx.moveTo(d.x + 5 * nodeRadius, d.y)
           ctx.arc(d.x, d.y, 5 * nodeRadius, 0, 2 * Math.PI)
-          ctx.fill()
-          ctx.restore()
         })
+        ctx.fill()
 
         ctx.restore()
       }
@@ -418,12 +416,12 @@ define(["d3"], function (d3) {
         ctx.strokeStyle = highlightColor
         ctx.lineCap = "round"
 
+        ctx.beginPath()
         highlightedLinks.forEach(function (d) {
-          ctx.beginPath()
           ctx.moveTo(d.source.x, d.source.y)
           ctx.lineTo(d.target.x, d.target.y)
-          ctx.stroke()
         })
+        ctx.stroke()
 
         ctx.restore()
       }