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 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claas-c
Copy link

@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 when the unit is 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.

@claas-c claas-c force-pushed the fix-path-with-gradient-svg-export branch from 66b6e05 to 803b249 Compare October 16, 2020 15:58
@claas-c claas-c force-pushed the fix-path-with-gradient-svg-export branch from 803b249 to 8dce4b6 Compare October 16, 2020 17:16
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.

1 participant