d3 / d3-zoom

Pan and zoom SVG, HTML or Canvas using mouse or touch input.
https://d3js.org/d3-zoom
ISC License
507 stars 143 forks source link

zoom and click-to-center not synchronized in v5 #196

Closed anyamiletic closed 4 years ago

anyamiletic commented 4 years ago

I've been trying to refactor this example of a collapsible tree to work in d3 v5. However, the zooming / centering functionality seems to have broken. If I click on a node to center on it, then zoom in / out, the zooming translates to the point where the previous zooming occurred, it doesn't take into account the centerNode function. This all seems to be working great in v4. Vice versa, after zooming if i click on a node to center it, the translation starts from the last centering (now it is not taking the zooming translation into account) my fiddle: https://jsfiddle.net/k8ebfvyo/4/ note: I have asked this question on stackoverflow already, but haven't had any luck.

mbostock commented 4 years ago

Sorry this isn’t working for you, but I don’t currently have time to help. Good luck!