I am using Raphael.js to create a “Play” button icon. However, the triangle is positioned too close to the edge of the circle. On mouseover, I am increasing the stroke width – the problem being that the triangle actually comes outside the circle, which is not what I want at all. The HTML is just a div with an id:
<html>
<head>
</head>
<body>
<div id="playB"></div>
</body>
</html>
The javascript is rather long so here is the jsfiddle
What is the easiest way to “move” a path of an SVG in this case? i.e. – starting further from the right and further from the top. I have tried various things, but apart from changing the size of an icon – multiplying each number of the path by x, I cannot manipulate icons at all. In this case move a specific element of the icon.
You need to split up the path in order to adjust the position of the triangle. I was able to do this by eye by picking out where the second “M” was in the path:
Then you can move the triangle over:
To keep the properties and animation intact, add both to a Raphael set:
Then you only need one small change: Change “this” in the mouseover commands to “playBP”. This may seem redundant, but “this” refers to the single element that was moused over, not the set.
jsFiddle updated
If you’d rather just fix the path, you can use the Raphael.mapPath() function to get the adjusted x/y for the triangle, like so: