From 3ecd9f05e4703d37014b2d0f3989b111a3045851 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 20 Oct 2016 19:35:51 -0400 Subject: [PATCH] fix previous commit --- websocket-ui/ui.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/websocket-ui/ui.js b/websocket-ui/ui.js index 40afd48..82dfd58 100644 --- a/websocket-ui/ui.js +++ b/websocket-ui/ui.js @@ -248,6 +248,7 @@ setInterval(function() { } var newPeers = {}; + var counter = 0; for ( var ed in e ) { var edge = e[ed]; draw.beginPath(); @@ -255,12 +256,18 @@ setInterval(function() { draw.lineWidth = edge[3]; draw.moveTo(edge[0].x * c.width, edge[0].y * c.height); draw.lineTo(edge[1].x * c.width, edge[1].y * c.height); - newPeers[edge[0].name] = edge[0]; - newPeers[edge[1].name] = edge[1]; + if(!newPeers[edge[0].name]) { + newPeers[edge[0].name] = edge[0]; + counter ++; + } + if(!newPeers[edge[1].name]) { + newPeers[edge[1].name] = edge[1]; + counter ++; + } draw.stroke(); } - - peers = newPeers; + newPeers.length = counter; + tpeers = newPeers;