forcegraph: just clear the whole canvas
This commit is contained in:
parent
c13e648cc6
commit
76fb29d5d8
@ -120,8 +120,6 @@ define(["d3"], function (d3) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var translateP, scaleP
|
|
||||||
|
|
||||||
function onPanZoom() {
|
function onPanZoom() {
|
||||||
savedPanZoom = {translate: zoomBehavior.translate(),
|
savedPanZoom = {translate: zoomBehavior.translate(),
|
||||||
scale: zoomBehavior.scale()}
|
scale: zoomBehavior.scale()}
|
||||||
@ -258,32 +256,15 @@ define(["d3"], function (d3) {
|
|||||||
var scale = zoomBehavior.scale()
|
var scale = zoomBehavior.scale()
|
||||||
var links = intLinks.filter(visibleLinks)
|
var links = intLinks.filter(visibleLinks)
|
||||||
|
|
||||||
var xExtent = d3.extent(intNodes, function (d) { return d.px })
|
|
||||||
var yExtent = d3.extent(intNodes, function (d) { return d.py })
|
|
||||||
|
|
||||||
if (translateP) {
|
|
||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.translate(translateP[0], translateP[1])
|
ctx.setTransform(1, 0, 0, 1, 0, 0)
|
||||||
ctx.scale(scaleP, scaleP)
|
ctx.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
ctx.clearRect(xExtent[0] - margin, yExtent[0] - margin,
|
|
||||||
xExtent[1] - xExtent[0] + 2 * margin,
|
|
||||||
yExtent[1] - yExtent[0] + 2 * margin)
|
|
||||||
ctx.restore()
|
ctx.restore()
|
||||||
}
|
|
||||||
|
|
||||||
ctx.save()
|
ctx.save()
|
||||||
ctx.translate(translate[0], translate[1])
|
ctx.translate(translate[0], translate[1])
|
||||||
ctx.scale(scale, scale)
|
ctx.scale(scale, scale)
|
||||||
|
|
||||||
if (!translateP)
|
|
||||||
ctx.clearRect(xExtent[0] - margin, yExtent[0] - margin,
|
|
||||||
xExtent[1] - xExtent[0] + 2 * margin,
|
|
||||||
yExtent[1] - yExtent[0] + 2 * margin)
|
|
||||||
|
|
||||||
// Remeber last translate/scale state
|
|
||||||
translateP = translate
|
|
||||||
scaleP = scale
|
|
||||||
|
|
||||||
var clientColor = "rgba(230, 50, 75, 1.0)"
|
var clientColor = "rgba(230, 50, 75, 1.0)"
|
||||||
var unknownColor = "#D10E2A"
|
var unknownColor = "#D10E2A"
|
||||||
var nodeColor = "#F2E3C6"
|
var nodeColor = "#F2E3C6"
|
||||||
|
Loading…
Reference in New Issue
Block a user