forcegraph: draw unseen nodes orange
This commit is contained in:
parent
23ded77089
commit
24987f4963
@ -19,7 +19,9 @@ define(["d3"], function (d3) {
|
|||||||
var nodes = []
|
var nodes = []
|
||||||
var uplinkNodes = []
|
var uplinkNodes = []
|
||||||
var nonUplinkNodes = []
|
var nonUplinkNodes = []
|
||||||
|
var unseenNodes = []
|
||||||
var unknownNodes = []
|
var unknownNodes = []
|
||||||
|
var graphNodes = []
|
||||||
var savedPanZoom
|
var savedPanZoom
|
||||||
|
|
||||||
var draggedNode
|
var draggedNode
|
||||||
@ -313,6 +315,7 @@ define(["d3"], function (d3) {
|
|||||||
var unknownColor = "#D10E2A"
|
var unknownColor = "#D10E2A"
|
||||||
var nonUplinkColor = "#F2E3C6"
|
var nonUplinkColor = "#F2E3C6"
|
||||||
var uplinkColor = "#5BAAEB"
|
var uplinkColor = "#5BAAEB"
|
||||||
|
var unseenColor = "#FFA726"
|
||||||
var highlightColor = "rgba(252, 227, 198, 0.15)"
|
var highlightColor = "rgba(252, 227, 198, 0.15)"
|
||||||
var nodeRadius = 6
|
var nodeRadius = 6
|
||||||
var cableColor = "#50B0F0"
|
var cableColor = "#50B0F0"
|
||||||
@ -364,6 +367,11 @@ define(["d3"], function (d3) {
|
|||||||
ctx.drawImage(uplinkNode, scale * r * d.x - uplinkNode.width / 2, scale * r * d.y - uplinkNode.height / 2)
|
ctx.drawImage(uplinkNode, scale * r * d.x - uplinkNode.width / 2, scale * r * d.y - uplinkNode.height / 2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var unseenNode = drawNode(unseenColor, nodeRadius, scale, r)
|
||||||
|
unseenNodes.filter(visibleNodes).forEach(function (d) {
|
||||||
|
ctx.drawImage(unseenNode, scale * r * d.x - unseenNode.width / 2, scale * r * d.y - unseenNode.height / 2)
|
||||||
|
})
|
||||||
|
|
||||||
ctx.restore()
|
ctx.restore()
|
||||||
|
|
||||||
// -- draw clients --
|
// -- draw clients --
|
||||||
@ -695,10 +703,12 @@ define(["d3"], function (d3) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
nodes = intNodes.filter(function (d) { return d.o.node })
|
nodes = intNodes.filter(function (d) { return !d.o.unseen && d.o.node })
|
||||||
uplinkNodes = nodes.filter(function (d) { return d.o.node.flags.uplink })
|
uplinkNodes = nodes.filter(function (d) { return d.o.node.flags.uplink })
|
||||||
nonUplinkNodes = nodes.filter(function (d) { return !d.o.node.flags.uplink })
|
nonUplinkNodes = nodes.filter(function (d) { return !d.o.node.flags.uplink })
|
||||||
|
unseenNodes = intNodes.filter(function (d) { return d.o.unseen && d.o.node })
|
||||||
unknownNodes = intNodes.filter(function (d) { return !d.o.node })
|
unknownNodes = intNodes.filter(function (d) { return !d.o.node })
|
||||||
|
graphNodes = nodes.concat(unseenNodes).concat(unknownNodes)
|
||||||
|
|
||||||
if (localStorageTest()) {
|
if (localStorageTest()) {
|
||||||
var save = JSON.parse(localStorage.getItem("graph/nodeposition"))
|
var save = JSON.parse(localStorage.getItem("graph/nodeposition"))
|
||||||
@ -718,9 +728,9 @@ define(["d3"], function (d3) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var diameter = graphDiameter(intNodes)
|
var diameter = graphDiameter(graphNodes)
|
||||||
|
|
||||||
force.nodes(intNodes)
|
force.nodes(graphNodes)
|
||||||
.links(intLinks)
|
.links(intLinks)
|
||||||
.size([diameter, diameter])
|
.size([diameter, diameter])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user