[TASK] Fastd lines and gravity

This commit is contained in:
Xaver Maierhofer 2016-06-09 00:20:10 +02:00
parent 10356c59ea
commit bbed795188
2 changed files with 4 additions and 25 deletions

View File

@ -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];

View File

@ -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";
}