D3 v4: Reset zoom state

前端 未结 5 1834
谎友^
谎友^ 2021-02-19 07:26

I have a SVG which can be zoomed and also a \"reset\" button. I\'m resetting the zoom with

zoom.transform(selection, d3.zoomIdentity)

This wor

5条回答
  •  别那么骄傲
    2021-02-19 08:15

    Also set scale in the reset

    $("#reset-zoom-button").click(() => {
        zoom.transform(container, d3.zoomIdentity.scale(1) );
    
    })
    

提交回复
热议问题