question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong viewbox size

See original GitHub issue

Hello, 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:open
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thepastocommented, Nov 6, 2017

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!

0reactions
neveldocommented, Nov 24, 2017

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 ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found