forcegraph: limit framerate
This commit is contained in:
parent
a3f473a6df
commit
ef7f60179a
|
@ -236,7 +236,18 @@ define(["d3"], function (d3) {
|
|||
d.y + margin > screenRect.top && d.y - margin < screenRect.bottom
|
||||
}
|
||||
|
||||
function redraw() {
|
||||
var oldTime = 0
|
||||
|
||||
function redraw(time) {
|
||||
var deltaTime = time - oldTime
|
||||
|
||||
if (deltaTime < 20) {
|
||||
requestAnimationFrame(redraw)
|
||||
return
|
||||
}
|
||||
|
||||
oldTime = time
|
||||
|
||||
var translate = zoomBehavior.translate()
|
||||
var scale = zoomBehavior.scale()
|
||||
var links = intLinks.filter(visibleLinks)
|
||||
|
@ -374,7 +385,7 @@ define(["d3"], function (d3) {
|
|||
}
|
||||
|
||||
function tickEvent() {
|
||||
redraw()
|
||||
requestAnimationFrame(redraw)
|
||||
}
|
||||
|
||||
function resizeCanvas() {
|
||||
|
|
Loading…
Reference in a new issue