-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix object.to data url #2487
Fix object.to data url #2487
Conversation
I add, after this change nothing in the library is calling renderAll(true) |
Perhaps it's time to remove it then? |
just waiting for you to ask. |
:) let's do it! the less old, unnecessary cruft the better On Sat, Sep 19, 2015 at 6:20 PM, Andrea Bogazzi [email protected]
|
@kangax ready to merge |
Gotta update changelog with back-incompat note |
It looks like this change has affected rendering of the This line short-circuits the canvas element used to render to the upper canvas, if the upper canvas exists. It does exist, but it is empty, so is renders the empty canvas as the fabric.Canvas's data URL. Previously, |
@taveras thank you for noticing. i resubmitted the fix. |
@asturur Awesome! I also had another strange observation: When calling If I call I realize that this may require a new issue be created to be understood and resolved, and I'll do so if you feel it necessary. |
What do you mean, if it is cropped, how do you know how large was the image before? |
I only meant cropped in the sense that it was clipped to the normal canvas size. It is this commit that seems to make the image in the outputted Data URL be the canvas scaled 2x, but clipped to the original dimensions. Here is an example of the effect of your most recent commit: again, the original reasoning for this change, was that I was getting a transparent image when using |
If toDataUrl is method of statiCanvas is better to render everything on the lower canvas and remove checks for upperCanvas and contextTop.
The real bug is somewhere else:
we were calling renderAll with allOnTop = true on staticCanvas.
So canvasToDrawOn was contextContainer.
But later we were cleaning the context just on allOnTop = false.
So both copies of object, scaled and unscaled were on the canvas.
The unscaled one coming from canvas.add() in the object.toDataURL.
really this allOnTop i think is something from the past, now we are not rendering anything on contextTop other than controls sometimes or selectors. i see no reasons to draw all on top.
But not time to check it now.
closes #2474