Skip to content

Instantly share code, notes, and snippets.

@Pyrolistical
Created December 6, 2013 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pyrolistical/7830655 to your computer and use it in GitHub Desktop.
Save Pyrolistical/7830655 to your computer and use it in GitHub Desktop.
getBBox-rounded-rect bug
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="snap.svg.js"></script>
</head>
<body>
<svg id="main" xmlns="http://www.w3.org/2000/svg" version="1.1" height=100%>
</svg>
<script>
var s = Snap("#main");
var rounded = s.rect(10, 20, 300, 400, 10);
rounded.node.id = "rounded-box";
var normal = s.rect(10, 500, 300, 400);
normal.node.id = "normal-box";
console.log("rounded snap getBBox()", rounded.getBBox());
console.log("normal snap getBBox()", normal.getBBox());
console.log("rounded native getBBox()", document.getElementById("rounded-box").getBBox());
console.log("normal native getBBox()", document.getElementById("normal-box").getBBox());
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment