-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap drawing in requestAnimationFrame (multicanvas). #1106
Conversation
src/drawer.multicanvas.js
Outdated
return; | ||
} else { | ||
peaks = channels[0]; | ||
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add support for opera and IE? … Maybe this would be something to put in utils, since it is also used in MultiCanvas and potentially other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this: https://gist.github.com/mrdoob/838785
K. I'll change it in a bit.
…On May 27, 2017 4:48 AM, "Martin Spencer" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/drawer.multicanvas.js
<#1106 (comment)>
:
> @@ -140,97 +140,105 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.MultiCanvas, {
},
drawBars: function (peaks, channelIndex, start, end) {
- // Split channels
- if (peaks[0] instanceof Array) {
- var channels = peaks;
- if (this.params.splitChannels) {
- this.setHeight(channels.length * this.params.height * this.params.pixelRatio);
- channels.forEach(function(channelPeaks, i) {
- this.drawBars(channelPeaks, i, start, end);
- }, this);
- return;
- } else {
- peaks = channels[0];
+ var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame;
Maybe something like this: https://gist.github.com/mrdoob/838785
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1106 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADFJWHS50QbwoW72Y9ktMTVPncUCsD2mks5r9-NJgaJpZM4NoQWj>
.
|
I don't know what's going on here. |
src/drawer.multicanvas.js
Outdated
|
||
drawLine: function (peaks, absmax, halfH, offsetY, start, end) { | ||
drawLine: utils.frame(function(peaks, absmax, halfH, offsetY, start, end) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utils
is undefined. It has to be WaveSurfer.util
. Please also restore the spaces after the function keyword.
It's a function call though. Tough call.. |
Also I wrapped drawLine by accident instead of the one above it (or so). My bad. |
anyone an idea what this error is about? https://travis-ci.org/katspaugh/wavesurfer.js/builds/237172952#L352 |
Yeah... it's because I don't have all the requestAnimationFrame PRs in one place, so it doesn't know about util.frame... |
You'll probably have to bring in more code in this PR so the travis build doesn't fail, or find a way to make travis build happy. |
Once the util PR is accepted, this one will work. |
what pr number? |
The one you pinged me about 20 min ago...! :P |
cool, just for reference so others don't have to dig around for the PR nr. You should probably add to the PR description something like "blocked by PR #" (for every relevant PR you made/make). |
Tests fail with:
so this type of method definition isn't allowed it seems.. |
It's completely unclear what is going on here. The same changes worked in the Canvas PR. |
Weird. Can you reproduce this error locally? |
Found the issue. See: #1120. |
The tests pass now, thanks! |
* Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js * I have no idea why this failed. * Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js
* Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js * I have no idea why this failed. * Update drawer.multicanvas.js * Update drawer.multicanvas.js * Update drawer.multicanvas.js
Wrap drawing in requestAnimationFrame (multicanvas) per #1084.
Blocked by #1107.