Browse Source

remove orphan nodes

websocket-ui
Jeff Becker 8 years ago
parent
commit
133fac0b55
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
  1. 10
      websocket-ui/ui.js

10
websocket-ui/ui.js

@ -1,4 +1,4 @@
var url = "ws://127.0.0.1:7666"; var url = "ws://127.0.0.1:7665";
var l = document.getElementById("log"); var l = document.getElementById("log");
var c = document.getElementById("main"); var c = document.getElementById("main");
@ -247,6 +247,7 @@ setInterval(function() {
drawPeer(getPeer(h)); drawPeer(getPeer(h));
} }
var newPeers = {};
for ( var ed in e ) { for ( var ed in e ) {
var edge = e[ed]; var edge = e[ed];
draw.beginPath(); draw.beginPath();
@ -254,10 +255,15 @@ setInterval(function() {
draw.lineWidth = edge[3]; draw.lineWidth = edge[3];
draw.moveTo(edge[0].x * c.width, edge[0].y * c.height); draw.moveTo(edge[0].x * c.width, edge[0].y * c.height);
draw.lineTo(edge[1].x * c.width, edge[1].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];
draw.stroke(); draw.stroke();
} }
peers = newPeers;
// draw nodes // draw nodes
var n = nodes.length; var n = nodes.length;

Loading…
Cancel
Save