From bbed795188167833bcff1e89d8f7d935db5a028e Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Thu, 9 Jun 2016 00:20:10 +0200 Subject: [PATCH] [TASK] Fastd lines and gravity --- lib/forcegraph.js | 20 +++----------------- lib/main.js | 9 +-------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/lib/forcegraph.js b/lib/forcegraph.js index cb9d05e..d454612 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -349,7 +349,7 @@ define(["d3", "helper"], function (d3, helper) { ctx.moveTo(d.source.x + dx * nodeRadius, d.source.y + dy * nodeRadius); ctx.lineTo(d.target.x - dx * nodeRadius, d.target.y - dy * nodeRadius); ctx.strokeStyle = d.o.type === "Kabel" ? cableColor : d.color; - ctx.globalAlpha = d.o.type === "fastd" || d.o.type === "L2TP" ? 0.1 : 0.8; + ctx.globalAlpha = d.o.type === "fastd" || d.o.type === "L2TP" ? 0.2 : 0.8; ctx.lineWidth = d.o.type === "fastd" || d.o.type === "L2TP" ? 1.5 : 2.5; ctx.stroke(); }); @@ -619,7 +619,7 @@ define(["d3", "helper"], function (d3, helper) { }) .linkStrength(function (d) { if (d.o.type === "fastd" || d.o.type === "L2TP") { - return 0; + return 0.02; } else { return Math.max(0.5, 1 / d.o.tq); } @@ -674,12 +674,7 @@ define(["d3", "helper"], function (d3, helper) { e.o = d; e.source = newNodesDict[d.source.id]; e.target = newNodesDict[d.target.id]; - - if (d.type === "fastd" || d.type === "L2TP") { - e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"; - } else { - e.color = linkScale(d.tq).hex(); - } + e.color = linkScale(d.tq).hex(); return e; }); @@ -722,15 +717,6 @@ define(["d3", "helper"], function (d3, helper) { d.labelB = offset + buffer.height / (2 * scale); }); - intLinks.forEach(function (d) { - d.source.neighbours[d.target.o.id] = {node: d.target, link: d}; - d.target.neighbours[d.source.o.id] = {node: d.source, link: d}; - - if (d.o.source && d.o.target) { - linksDict[d.o.id] = d; - } - }); - intNodes.forEach(function (d) { d.neighbours = Object.keys(d.neighbours).map(function (k) { return d.neighbours[k]; diff --git a/lib/main.js b/lib/main.js index 950dcc1..7105397 100644 --- a/lib/main.js +++ b/lib/main.js @@ -114,15 +114,8 @@ define(["moment", "router", "leaflet", "gui", "helper", "moment.de"], }); links.forEach(function (d) { - if (d.type === "tunnel" || d.type === "fastd") { + if (d.target.node.flags.gateway === true || (d.source.node !== undefined && d.source.node.flags.gateway === true)) { d.type = "fastd"; - } else if (d.type === "l2tp") { - d.type = "L2TP"; - d.target.node.flags.uplink = true; - } else if (d.type === "wireless") { - d.type = "Wifi"; - } else if (d.type === "other") { - d.type = "Kabel"; } else { d.type = "N/A"; }