I have a number of arcs that make up a circle and what I need to do is on the click of an arc translate the center point of the arc and zoom in.
I have done the work for translating and scalling but the center point i get for the arc needs translating to screen coords (or the larger svg container coords, not 100% on that) so that the translate actually goes to the correct place and puts the arc in the middle of the screen (camera).
I have looked around on here and not had much joy. I did get the way how to get the center point of an arc off of here by using the svg's bounding box. But trying the other things I have come across I have not had anymore joy.
Cheers Mark
CODE
var coords = getCentroid(arcParthObj);
//seperated scale and translate as when both together the position it translates to changes (to the wrong one)
RadarDraw.ZoomListener.scale(6);
RadarDraw.ZoomListener.event(svg.transition().duration(500));
RadarDraw.ZoomListener.translate([-text[0], -text[1]]);
RadarDraw.ZoomListener.event(svg.transition().duration(500));
function getCentroid(selection) {
var element = selection.parentNode;
// use the native SVG interface to get the bounding box
var bbox = element.getBBox();
// return the center of the bounding box
return [bbox.x + bbox.width/2, bbox.y + bbox.height/2];
}