Skip to content

Commit

Permalink
Wrap drawing in requestAnimationFrame. (#1105)
Browse files Browse the repository at this point in the history
* Wrap drawing in requestAnimationFrame.

Wrap drawing in requestAnimationFrame per #1084.

* Update drawer.canvas.js

* Update drawer.canvas.js

* Update drawer.canvas.js

* Update drawer.canvas.js

* Update drawer.canvas.js
  • Loading branch information
agamemnus authored and katspaugh committed Jun 1, 2017
1 parent 0552da8 commit bc57ec8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/drawer.canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
}
},

drawBars: function (peaks, channelIndex, start, end) {
drawBars: WaveSurfer.util.frame(function (peaks, channelIndex, start, end) {
var my = this;
// Split channels
if (peaks[0] instanceof Array) {
Expand Down Expand Up @@ -124,9 +124,9 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
cc.fillRect(i + $, halfH - h + offsetY, bar + $, h * 2);
}
}, this);
},
}),

drawWave: function (peaks, channelIndex, start, end) {
drawWave: WaveSurfer.util.frame(function (peaks, channelIndex, start, end) {
var my = this;
// Split channels
if (peaks[0] instanceof Array) {
Expand Down Expand Up @@ -201,7 +201,7 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
// Always draw a median line
cc.fillRect(0, halfH + offsetY - $, this.width, $);
}, this);
},
}),

updateProgress: function (pos) {
this.style(this.progressWave, { width: pos + 'px' });
Expand Down

0 comments on commit bc57ec8

Please sign in to comment.