On click automatically draw rectangle on the SVG Map
up vote
-1
down vote
favorite
I tried an example of drawing circle in SVG map but i want to draw rectangle and i am unable to do it. My task is to select one of the rectangle of particular shape from left panel and goto map and then click wherever i want. On cursor click rectangle should be created. There are different size of rectangle on left panel of my website like 3x3, 3x6, 6x6 etc. below is the example
var svg = document.getElementById('mysvg'), NS = svg.getAttribute('xmlns'), local = svg.getElementById('local'), coords = document.getElementById('coords'); // add a circle to the SVG svg.addEventListener('click', function(e) { var t = e.target, x = e.clientX, y = e.clientY, target = (t == svg ? svg : t.parentNode), svgP = svgPoint(ta...