Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zoom out D3 Force-Directed Graph without using mouse wheel

I've implemented zoom on force-directed graph

svg.call(d3.behavior.zoom().on("zoom", rescale))


function rescale() {
        var trans = d3.event.translate;
        var scale = d3.event.scale;

        svg.attr("transform",
            "translate(" + trans + ")"
                + " scale(" + scale + ")");
    }

Graph can be zoomed in either using mouse wheel or double click on it. I need some advice how to implement zooming out without using mouse wheel.

like image 569
paramosh Avatar asked Mar 03 '26 05:03

paramosh


1 Answers

Shift-double click should zoom out.

like image 56
thesuperav Avatar answered Mar 05 '26 18:03

thesuperav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!