visualizer: ensure canvas loop is running when starting its own loop
This commit is contained in:
parent
836cd1a1ed
commit
1567dde5d3
2 changed files with 9 additions and 4 deletions
|
|
@ -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)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue