New wiki-page
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
width:100%; | width:100%; | ||
</style> | </style> | ||
<script type="text/javascript" | <script type="text/javascript"> | ||
var pt = svg.createSVGPoint(); // Created once for document | |||
function alert_coords(evt) { | |||
pt.x = evt.clientX; | |||
} | pt.y = evt.clientY; | ||
// The cursor point, translated into svg coordinates | |||
var cursorpt = pt.matrixTransform(svg.getScreenCTM().inverse()); | |||
console.log("(" + cursorpt.x + ", " + cursorpt.y + ")"); | |||
} | |||
</script> | </script> |
Revision as of 18:25, 9 August 2017
<style>
- map-container{
position:relative; width:300px; height:300px;
}
- map-svg{
position:absolute; left:0px; top:0px;
}
- map-catcher{
position:absolute; left:0px; top:0px; height:100%; width:100%;
</style> <script type="text/javascript"> var pt = svg.createSVGPoint(); // Created once for document
function alert_coords(evt) {
pt.x = evt.clientX; pt.y = evt.clientY;
// The cursor point, translated into svg coordinates var cursorpt = pt.matrixTransform(svg.getScreenCTM().inverse()); console.log("(" + cursorpt.x + ", " + cursorpt.y + ")");
} </script>