I'm developing an interactive map, where can be seen arrows. These arrows are made with SVG code. When the SVG container is clicked, a popup is showed like in the figure down below:
The main issue, is that the cointainer box (marked with solid 1px white border) act as click zone to show the popup, making it difficult to click specifically one of them when some arrows are near, like in the next example:
So I'm trying to make the svg container like and little bigger arrow:
Making it easily clickable the desired arrow.
I'm not a very experienced HTML/javascript developer, so I don't know if it's possible to "shapelize" the SVG container to it content, making it with the same "arrow" shape, and if where possible, How I should proceed?
EDIT 1: A jsfiddle with an example:
I'm using the following javascript code:
function windArrow(speed, angle)
{
//var angulo = 0;
var direction = 90-angle;
// var speed = 20;
var x = speed*Math.cos(deg2rad(direction)).toFixed(4);
var y = speed*Math.sin(deg2rad(direction)).toFixed(4);
var svgHeader = '<svg version="1.1" id="arrow_svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="100px" ><defs><marker id="arrowHead" markerWidth="10" markerHeight="10" refX="0" refY="1" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L0,2 L2,1 z" stroke="none" fill="red"/><path stroke-width=".3" stroke="white" fill="none" d="M0,0 L0,2 L2,1 z" /></marker></defs>';
var outerArrow = '<g class="outerArrow"> <path marker-end="url(#arrowHead)" d="M50,50 l'+x.toString()+','+y.toString()+'" /></g>';
var innerArrow = '<g class="innerArrow"><path marker-end="url(#arrowHead)" d="M50,50 l'+x.toString()+','+y.toString()+'" /></g>';
var svgFoot = '</svg>';
return svgHeader+outerArrow + '\n' + innerArrow + svgFoot;
}
document.getElementById('arrow').innerHTML = windArrow(20,45);