d3 / d3-zoom

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

How to reset zoom? #147

Closed rabejens closed 6 years ago

rabejens commented 6 years ago

I employed a simple zooming with d3-zoom which works fine using rescaleX and rescaleY for my axes, and yust setting the transform of my line chart objects to the transform of the event object, and setting the stroke width accordingly.

Now I added a reset button that does plotsContainer.call(zoom.transform, d3.zoomIdentity.scale(1)), but I have one problem: When zooming again, the picture "jumps" to the previous zoom state.

Is there a way to remove all stored zoom state?

rabejens commented 6 years ago

I saw that this was asked before: https://github.com/d3/d3-zoom/issues/107