Properly handle link types ()

* Properly handle link types

* fixup! Properly handle link types
This commit is contained in:
Marvin W 2016-07-04 11:29:16 +02:00 committed by PetaByteBoy // Milan Pässler
parent 2844a203d5
commit 760cca6806
2 changed files with 25 additions and 14 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 !== "fastd" && d.link.o.type !== "L2TP"
return !d.link.o.isVPN
})
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 === "fastd" || d.o.type === "L2TP" ? 0.1 : 0.8
ctx.lineWidth = d.o.type === "fastd" || d.o.type === "L2TP" ? 1.5 : 2.5
ctx.globalAlpha = d.o.isVPN ? 0.1 : 0.8
ctx.lineWidth = d.o.isVPN ? 1.5 : 2.5
ctx.stroke()
})
@ -523,7 +523,7 @@ define(["d3"], function (d3) {
}
var links = intLinks.filter(function (d) {
return d.o.type !== "fastd" && d.o.type !== "L2TP"
return !d.o.isVPN
}).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 === "fastd" || d.o.type === "L2TP")
if (d.o.isVPN)
return 0
else
return LINK_DISTANCE
})
.linkStrength(function (d) {
if (d.o.type === "fastd" || d.o.type === "L2TP")
if (d.o.isVPN)
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 === "fastd" || d.type === "L2TP")
if (d.isVPN)
e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"
else
e.color = linkScale(d.tq).hex()