react-force-graph
react-force-graph copied to clipboard
change controlType on the go after graph is rendered
Describe the bug Sir, is there a way to change the controlType on the go. Say after the graph has rendered, I want to switch between different controlType modes. putting the controlType in the state and setState() won't work.
A simplified version of the code:
state = {
controlType: "trackball" as "trackball" | "orbit" | "fly",
};
<ForceGraph3D
...
controlType={this.state.controlType}
onBackgroundClick={() => {
this.setState({
controlType: "fly",
});
}}
/>
@Kaby-Lake I'm afraid this is not possible. The controlType is a static prop. Changing it after component instantiation will have no effect.
ok, thanks for your help, I may end up with creating 3 different components with 3 static controlTypes