-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to show a context menu on right click event #68
Comments
Apologies for the necropost. This is for completion of the record, as this is a top Google result when I was searching for a solution to this issue. From the example in README.md, it seems you can get access to the "network" object via the following property (https://github.com/crubier/react-graph-vis):
From there, the vis.js network module documentation states the following about the "oncontext" event (https://visjs.github.io/vis-network/docs/network/#event_oncontext):
The following additions to your code should point you in the right direction with one caveat. I'm having an issue lining up the
|
Maybe you can try using |
Hi, I found myself in a hurry since I'm trying to implement an event that shows a context menu when a user right clicks in a node or in an edge of his or her graph. I've tried different approaches (using a ref to access api functions like getPositions or the function getNodeAt), but no one seemed to work. This is a simplification of the component I'm working with:
export class MainPage extends Component {
constructor(props) {
super(props)
}
right_click = (event) => {
//show popup...
}
render() {
return (
<div id={"mygraph"}>
<Graph
graph={this.state.graph}
options={this.state.options}
events={this.state.events}
ref={ref => (this.g = ref)}
/>;
)
}
}
I'll appreciate any help. Thanks with your awesome work with vis.
Regards,
Marcos
The text was updated successfully, but these errors were encountered: