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()
       }