diff --git a/src/client/widgets/common/queue.js b/src/client/widgets/common/queue.js index 21911f58..9b0ba092 100644 --- a/src/client/widgets/common/queue.js +++ b/src/client/widgets/common/queue.js @@ -19,11 +19,15 @@ class CanvasQueue extends EventEmitter{ this.queue[widget.hash] = widget this.flushed = 0 + if (!this.running) this.startLoop() - if (!this.running) { - this.running = true - requestAnimationFrame(this.bindedLoop) - } + } + + startLoop() { + + this.running = true + this.flushed = 0 + requestAnimationFrame(this.bindedLoop) } diff --git a/src/client/widgets/graphs/visualizer.js b/src/client/widgets/graphs/visualizer.js index 5e555739..3fcd592b 100644 --- a/src/client/widgets/graphs/visualizer.js +++ b/src/client/widgets/graphs/visualizer.js @@ -53,6 +53,7 @@ module.exports = class Visualizer extends StaticProperties(Plot, {rangeX: {min: if (!this.looping) { this.lastUpdate = Date.now() canvasQueue.on('frame', this.bindedLoop) + if (!canvasQueue.running) canvasQueue.startLoop() this.looping = true this.ticks = 0 }