neo4j-contrib / neovis.js

Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.
Apache License 2.0
1.59k stars 324 forks source link

Is there a double click event feature in neovis.js? #371

Closed SeXyTeA-x closed 10 months ago

SeXyTeA-x commented 10 months ago

I want to implement the function of double-clicking the node, but I find that the api document seems to provide only the event of clicking the node, may I ask whether there is a double-clicking node event in neovis.js

thebestnom commented 10 months ago

Hmm... The neovis api doesn't have it, you jave 2 options, hook the network object normal double click api and check which node/rel was clicked, second options is to add it to neovis and open PR which is always welcome 😄

SeXyTeA-x commented 10 months ago

emmm,do you mean to use this? viz.network.addEventListener('dblclick', function(event) { console.log(event) }); But the code is wrong

thebestnom commented 10 months ago

Yes, but make sure that's it runs after the render completes

SeXyTeA-x commented 10 months ago

Here's how I use it:

viz.registerOnEvent('completed', (e) => {
                console.log(viz.network);
                viz.network.addEventListener('dblclick', function() { 
                    console.log(1) 
                });
 });

But console.log(1) is not triggered when I double-click

thebestnom commented 10 months ago

https://visjs.github.io/vis-network/docs/network/#Events The event is named doubleClick

SeXyTeA-x commented 10 months ago

Oh, I didn't pay attention. Thank you for your patience

thebestnom commented 10 months ago

No problem 😄