forcegraph, main: l2tp support

This commit is contained in:
Milan Pässler 2016-04-24 01:02:17 +02:00
parent 2a78af4208
commit 2f28c51da1
2 changed files with 15 additions and 11 deletions

View file

@ -214,7 +214,7 @@ define(["d3"], function (d3) {
function drawLabel(d) {
var neighbours = d.neighbours.filter(function (d) {
return d.link.o.type !== "VPN"
return d.link.o.type !== "fastd" && d.link.o.type !== "L2TP"
})
var sum = neighbours.reduce(function (a, b) {
@ -332,8 +332,8 @@ define(["d3"], function (d3) {
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 === "VPN" ? 0.1 : 0.8
ctx.lineWidth = d.o.type === "VPN" ? 1.5 : 2.5
ctx.globalAlpha = d.o.type === "fastd" || d.o.type === "L2TP" ? 0.1 : 0.8
ctx.lineWidth = d.o.type === "fastd" || d.o.type === "L2TP" ? 1.5 : 2.5
ctx.stroke()
})
@ -523,7 +523,7 @@ define(["d3"], function (d3) {
}
var links = intLinks.filter(function (d) {
return d.o.type !== "VPN"
return d.o.type !== "fastd" && d.o.type !== "L2TP"
}).filter(function (d) {
return distanceLink(e, d.source, d.target) < LINE_RADIUS
})
@ -584,13 +584,13 @@ define(["d3"], function (d3) {
.charge(-250)
.gravity(0.1)
.linkDistance(function (d) {
if (d.o.type === "VPN")
if (d.o.type === "fastd" || d.o.type === "L2TP")
return 0
else
return LINK_DISTANCE
})
.linkStrength(function (d) {
if (d.o.type === "VPN")
if (d.o.type === "fastd" || d.o.type === "L2TP")
return 0
else
return Math.max(0.5, 1 / d.o.tq)
@ -644,7 +644,7 @@ define(["d3"], function (d3) {
e.source = newNodesDict[d.source.id]
e.target = newNodesDict[d.target.id]
if (d.type === "VPN")
if (d.type === "fastd" || d.type === "L2TP")
e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"
else
e.color = linkScale(d.tq).hex()