Skip to content
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

toDataURL broken in beta6 for the "StaticCanvas" object #4213

Closed
ncou opened this issue Aug 17, 2017 · 6 comments · Fixed by #4229
Closed

toDataURL broken in beta6 for the "StaticCanvas" object #4213

ncou opened this issue Aug 17, 2017 · 6 comments · Fixed by #4229
Labels

Comments

@ncou
Copy link
Collaborator

ncou commented Aug 17, 2017

Hi,

I got a problem with the latest version and the browser FF.
I got 2 canvas one over another (one for the main canvas, and another below for the animated background).
In IE and FF the background canvas is not displayed. It seems to me the "cancelAnimFrame" prevent the rendering of the second canvas. If i put this code line in comments, all workfine (the second canvas is draw).

renderAll: function () {
      var canvasToDrawOn = this.contextContainer;
      if (this.isRendering) {
        **fabric.util.cancelAnimFrame(this.isRendering);**
      }
      this.renderCanvas(canvasToDrawOn, this._objects);
      return this;
    },

I could do a fiddle later if this help.

@ncou ncou changed the title requestRenderAll an 2 canvas on the same page. requestRenderAll and 2 canvas on the same page. Aug 17, 2017
@asturur
Copy link
Member

asturur commented Aug 18, 2017

Would you make a fiddle so that i can see the problem? i have no time to write by myself

@ncou
Copy link
Collaborator Author

ncou commented Aug 18, 2017

Happy you didn't do the jsfiddle because the problem is not on the 2 layered canvas.
In fact my below canvas is a StaticCanvas, and it's the toDataURL function who is broken, it will clear the canvas, so when my app generated the thumbnail it cleared the background canvas.
I didn't have this behavior with Chrome, perhaps a cache problem.

Here is a fiddle :
http://jsfiddle.net/eA3xH/186/

PS : The toDataURL workfine with the "Canvas" object, it seems broken for the "StaticCanvas" object.
PS : It work fine with the beta4, the problem seems present only in beta6.

@ncou ncou changed the title requestRenderAll and 2 canvas on the same page. toDataURL broken in beta6 for the "StaticCanvas" object Aug 18, 2017
@asturur
Copy link
Member

asturur commented Aug 18, 2017

Try to leave a functional fiddle with the example.
It can be that toDataUrl has some problem with the recent renderAllRequest vs renderAll

Let's try to understand what is it.

@asturur
Copy link
Member

asturur commented Aug 18, 2017

oh well is clear. we are killing the bg color.

@asturur
Copy link
Member

asturur commented Aug 18, 2017

http://jsfiddle.net/eA3xH/187/

So another renderAll is required after the dataUrl.
This is wrong.
I ll try to fix it.

@asturur
Copy link
Member

asturur commented Aug 18, 2017

ok found the error!
i ll push it up with some cumulative fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants