[TASK] CGL - Optimize returns and unnecessary math
This commit is contained in:
parent
f716966eaa
commit
aa9416ed9b
@ -271,8 +271,7 @@ define(["d3"], function (d3) {
|
|||||||
|
|
||||||
function drawNode(color, radius, scale, r) {
|
function drawNode(color, radius, scale, r) {
|
||||||
var node = document.createElement("canvas");
|
var node = document.createElement("canvas");
|
||||||
node.width = scale * radius * 8 * r;
|
node.height = node.width = scale * radius * 8 * r;
|
||||||
node.height = node.width;
|
|
||||||
|
|
||||||
var nctx = node.getContext("2d");
|
var nctx = node.getContext("2d");
|
||||||
nctx.scale(scale * r, scale * r);
|
nctx.scale(scale * r, scale * r);
|
||||||
@ -286,12 +285,12 @@ define(["d3"], function (d3) {
|
|||||||
nctx.arc(0, 0, radius, 0, 2 * Math.PI);
|
nctx.arc(0, 0, radius, 0, 2 * Math.PI);
|
||||||
|
|
||||||
nctx.strokeStyle = "rgba(255, 0, 0, 1)";
|
nctx.strokeStyle = "rgba(255, 0, 0, 1)";
|
||||||
nctx.shadowOffsetX = node.width * 1.5 + 0;
|
nctx.shadowOffsetX = node.width * 1.5;
|
||||||
nctx.shadowOffsetY = node.height * 1.5 + 3;
|
nctx.shadowOffsetY = node.height * 1.5 + 3;
|
||||||
nctx.shadowBlur = 12;
|
nctx.shadowBlur = 12;
|
||||||
nctx.shadowColor = "rgba(0, 0, 0, 0.16)";
|
nctx.shadowColor = "rgba(0, 0, 0, 0.16)";
|
||||||
nctx.stroke();
|
nctx.stroke();
|
||||||
nctx.shadowOffsetX = node.width * 1.5 + 0;
|
nctx.shadowOffsetX = node.width * 1.5;
|
||||||
nctx.shadowOffsetY = node.height * 1.5 + 3;
|
nctx.shadowOffsetY = node.height * 1.5 + 3;
|
||||||
nctx.shadowBlur = 12;
|
nctx.shadowBlur = 12;
|
||||||
nctx.shadowColor = "rgba(0, 0, 0, 0.23)";
|
nctx.shadowColor = "rgba(0, 0, 0, 0.23)";
|
||||||
@ -554,7 +553,6 @@ define(["d3"], function (d3) {
|
|||||||
|
|
||||||
if (links.length > 0) {
|
if (links.length > 0) {
|
||||||
router.link(links[0].o)();
|
router.link(links[0].o)();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
return "distance" in d && d.type !== "VPN";
|
return "distance" in d && d.type !== "VPN";
|
||||||
});
|
});
|
||||||
|
|
||||||
var lines = graph.map(function (d) {
|
return graph.map(function (d) {
|
||||||
var opts = {
|
var opts = {
|
||||||
color: d.type === "Kabel" ? "#50B0F0" : linkScale(d.tq).hex(),
|
color: d.type === "Kabel" ? "#50B0F0" : linkScale(d.tq).hex(),
|
||||||
weight: 4,
|
weight: 4,
|
||||||
@ -156,8 +156,6 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
|
|
||||||
return line;
|
return line;
|
||||||
});
|
});
|
||||||
|
|
||||||
return lines;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconOnline = {color: "#1566A9", fillColor: "#1566A9", radius: 6, fillOpacity: 0.5, opacity: 0.5, weight: 2, className: "stroke-first"};
|
var iconOnline = {color: "#1566A9", fillColor: "#1566A9", radius: 6, fillOpacity: 0.5, opacity: 0.5, weight: 2, className: "stroke-first"};
|
||||||
|
@ -73,7 +73,7 @@ define(["leaflet", "rbush"],
|
|||||||
return [x, y, x + width, y + height];
|
return [x, y, x + width, y + height];
|
||||||
}
|
}
|
||||||
|
|
||||||
var c = L.TileLayer.Canvas.extend({
|
return L.TileLayer.Canvas.extend({
|
||||||
onAdd: function (map) {
|
onAdd: function (map) {
|
||||||
L.TileLayer.Canvas.prototype.onAdd.call(this, map);
|
L.TileLayer.Canvas.prototype.onAdd.call(this, map);
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
@ -235,6 +235,4 @@ define(["leaflet", "rbush"],
|
|||||||
}).forEach(drawLabel);
|
}).forEach(drawLabel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return c;
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user