I am trying to apply the van Wijk Smooth Zooming example to a D3 force-directed graph I am working that already has the drag+zoom functioning on it. However, I don\'t know h
Actually, I just figured it out based on the clicked function in this example. My equation was wrong for my scale and translate numbers. I needed to get my translate numbers this way:
translate = [width / 2 - scale * x, height / 2 - scale * y]
Then I needed to call() the zoom behavior with the transition on the zoom behavior itself like below with the ".event" at the end to make it fire:
svg.transition().duration(750)
.call(zoom.translate(translate).scale(scale).event);
and not doing it the wrong way by translating the svg like I was doing before:
svg.transition().duration(750)
.attr("transform", translate(translate).scale(scale));