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

Fixed SvgExport in path with gradient and added tests #6654

Merged
merged 1 commit into from
Oct 17, 2020

Conversation

claas-c
Copy link
Contributor

@claas-c claas-c commented Oct 16, 2020

There seems to be a problem in fabric with the svg export for a percentage based gradient on a path element. Here is a comparison between the rendering on canvas and in the exported svg:
https://codesandbox.io/s/clever-mountain-u0fxv?file=/src/index.js

When removing the subtraction of pathOffset from offset in the toSvg function of the gradient with the unit percentage, the exported svg looks like the rendering on canvas, as can be seen in this codesandbox:
https://codesandbox.io/s/nice-vaughan-l3sj4?file=/src/index.js

I added two visual tests to this PR, the first one tests if the gradient is correctly rendered on canvas and succeeds also for the current version. The second one tests the exported svg image and only succeeds with my changes. I am not sure if these tests are in the correct files or are performed at the right position. I could not find any guidelines for creating visual tests.

@asturur
Copy link
Member

asturur commented Oct 17, 2020

Pr is good! thanks.

@asturur asturur merged commit 1cdfa80 into fabricjs:master Oct 17, 2020
@asturur asturur mentioned this pull request Dec 23, 2020
shanicerae pushed a commit to shanicerae/fabric.js that referenced this pull request Jan 16, 2021
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 this pull request may close these issues.

2 participants