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

Inconsistency in Canvas Zoom and SVG Background behavior #4801

Closed
semiadam opened this issue Mar 11, 2018 · 3 comments · Fixed by #4852
Closed

Inconsistency in Canvas Zoom and SVG Background behavior #4801

semiadam opened this issue Mar 11, 2018 · 3 comments · Fixed by #4852

Comments

@semiadam
Copy link

semiadam commented Mar 11, 2018

It seems to me that the goal of toSVG() is to replicate the current view of the canvas, including its zoom level, and because of that, setZoom() impacts SVG viewBox in the output.

The problem is, if setBackgroundcolor() is used, the background element stays the same size, regardless of the zoom level, so for cases that zoom is less than 1, the SVG output looks different that canvas view (background is small):
http://jsfiddle.net/Da7SP/1127/

Canvas view:
image

SVG View:
image

A related issue is, if user sets a custom viewBox for SVG output, the background color won't be extended all the way to the edge of the viewBox.

If confirmed as a bug, I think the easiest fix is to change width and height of background to 100%, so both of the above use cases will be covered.

<rect x="0" y="0" width="100%" height="100%" fill="red"></rect>

@semiadam
Copy link
Author

@asturur do you have any suggestions on this?

@asturur
Copy link
Member

asturur commented Mar 26, 2018

i agree that being the color a color, and supposed to fill, the 100% fix is completely OK.

@asturur
Copy link
Member

asturur commented Mar 26, 2018

just to add that this behaviour of the full viewport is optional with the boolean
canvas.svgViewportTransformation

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.

2 participants