jacomyal / sigma.js

A JavaScript library aimed at visualizing graphs of thousands of nodes and edges
https://www.sigmajs.org/
MIT License
11.29k stars 1.59k forks source link

Rotating the view with a mouse #1374

Closed bblanchon closed 1 year ago

bblanchon commented 1 year ago

Hi,

Thanks a lot for this incredible library!

I noticed I could rotate the view with a touch screen. Is there any way to do so with a mouse?

Best regards, Benoit

wthrajat commented 1 year ago

Following this

sim51 commented 1 year ago

I created a sandbox to illustrate how to do that : https://codesandbox.io/s/sigmajs-issue-1374-8qc4gs

To rotate the graph, you only need to set the state of the camera : renderer.getCamera().setState({ angle: deltaAngle }); The rest of the code is pretty much which gesture you w&nt to use and how to listen it.

Hope it helps.

bblanchon commented 1 year ago

Excellent! Thanks a lot, Benoît.