Wrong viewbox size
See original GitHub issueHello, I recently found this amazing tool to do some experiment, so thanks for your work! I followed your howto to convert SVG file to a Raphael format. I tried to import my home map from a svg, but i got a shifted viewbox image, here’s an example.
What am i donig wrong?
Adding this code, i can center my image, but it lost viewport size on zoom cahnges.
afterInit : function(container, paper, areas, plots, options) {
paper.setViewBox(-80, -20, 350, 303, false)
}
Thanks for your help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SVG wrong size with viewBox width/height non-integers
Expected results: The size of the SVG element should be 200×350 px, like in Chrome, Safari and Edge. Note that the viewBox height...
Read more >Width of SVG isn't correct when viewBox is defined
I am trying to understand why my SVG icon is not rendered correctly. The icon is a little smallest that my SVG element...
Read more >Specifying `viewBox`, `width`, and `height` leads to incorrect ...
It has something to do with the width and height attributes. The way flutter_svg works is if there's a viewBox, it ignores width...
Read more >Intrinsic Sizing - SVG
Authors must manually edit the file and remove the width/height or set them to a percentage value and ensure a suitable viewBox is...
Read more >Content does not size correctly to viewport - Sitebulb
This means that the URL in question is not responsive, and the page content does not size accordingly when the screen size is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! Thanks for your answer! I already done everything you suggested above, but i investigated a little more, i converted back my map.js file to svg with mapael to SVG tool, and than i resized document page again. Finally i got a perfect SVG! Thanks again for your time and your work!
Hello @ChristopherGS ,
Sorry for my late answer ! It seems that there is a remaining viewbox attribute within the SVG, I think the steps below with inkscape should solve your issue 👍
1 / Edit > XML Editor > click on <svg> node, and then, delete the viewBox attribute. 2 / File > Document properties > Resize page to content > Resize page to drawing or selection
Maybe the documention should be improved on this point.
Does it help you ?