I think that what you're looking for is:

function () {
    var t = d3.transform("transform")),
        x = t.translate[0],
        y = t.translate[1];

    var scale = 10;

        .call(zoom.translate([((x * -scale) + (svgWidth / 2)), ((y * -scale) + svgHeight / 2)])

Where this represents the element. Have a look here for a working example. In the example you'll be able to zoom to element after pressing on it. Also if panning and zooming an svg is all you need to do check out this library. It just works, no maths required :).

Related Query