Calculating the viewport for an SVG. View source for the function, or see "Determining the SVG viewport in global/root coordinates" for details.

If you do NOT see a green stroke exactly around the white box at any point, the calculateViewport() function is not working correctly.

Copyright 2014 Gavin Kistner. Reuse permitted under the license terms at