Skip to content

Instantly share code, notes, and snippets.

@jorgehatccrma
Last active December 28, 2015 18:18
Show Gist options
  • Save jorgehatccrma/7541710 to your computer and use it in GitHub Desktop.
Save jorgehatccrma/7541710 to your computer and use it in GitHub Desktop.
polymer bug?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<!-- Including this makes the code below crash -->
<!--script src="libs/polymer.min.js"></script-->
<script type="text/javascript" src="libs/jquery-1.9.1.js"></script>
</head>
<body>
<svg id="svg_container" width="100" heigt="100"><rect id="a_rect" width="100" height="100"></rect></svg>
<script>
$(document).ready(function() {
var r = document.querySelector("#a_rect");
r.addEventListener('click', function(event) {
var m = r.getScreenCTM();
var root = document.getElementById("svg_container");
var p = root.createSVGPoint();
p.x = event.clientX;
p.y = event.clientY;
p = p.matrixTransform(m.inverse());
console.log(p);
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment