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 multiplier not applied to shadow's values #2939

Closed
ghost opened this issue May 4, 2016 · 1 comment · Fixed by #2940
Closed

toDataUrl multiplier not applied to shadow's values #2939

ghost opened this issue May 4, 2016 · 1 comment · Fixed by #2940

Comments

@ghost
Copy link

ghost commented May 4, 2016

Version

1.6.1

Test Case

http://jsfiddle.net/yfzv4x87/

If you are on retina screen then you must scroll all the way to the bottom right in jsfiddle render. The image is very large on retina. Not so big on 1:1 pixel ratio screen.

Screen shot of jsfiddle:
screen shot 2016-05-04 at 2 57 48 pm

On top is canvas, on bottom is img. Notice shadow in img.

Steps to reproduce

  1. Create textbox with shadow
  2. Take toDataUrl of textbox with multiplier of 5
  3. Insert data url into image

Expected Behavior

Image's shadow matches canvas shadow

Actual Behavior

Image shadow appears less offset and less blurred than canvas original

Screen shot of canvas:

screen shot 2016-05-04 at 10 32 50 am

Screen shot of image, after multiplier applied to data URL:

screen shot 2016-05-04 at 10 32 56 am

@asturur
Copy link
Member

asturur commented May 4, 2016

https://github.com/kangax/fabric.js/blob/master/src/mixins/canvas_dataurl_exporter.mixin.js#L128

Problem is here.
html canvas never scale the shadows. We scale the shadow keeping track of the multipliers from canvasZoom and objectZoom and retinaZoom.

When we set a direct ctx.scale() like that we fail at recovering it later when is time to render the shadows.

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

Successfully merging a pull request may close this issue.

1 participant