uber / react-digraph

A library for creating directed graph editors
MIT License
2.62k stars 268 forks source link

Compatibility with mobile (touch devices) #215

Open tomasjuran opened 4 years ago

tomasjuran commented 4 years ago

Is your feature request related to a problem? Please describe. React-digraph currently doesn't support touch devices

Describe the solution you'd like I would like to help add support for mobile devices, at least on basic functionality (panning, zooming, moving and selecting nodes and edges).

Describe alternatives you've considered The solution in #210 didn't work for me. I also tried overriding touchmove and touchstart in graph-view.js but couldn't find which special cases should be handled differently than using d3.mouse.

https://github.com/uber/react-digraph/blob/4e89df837c233a9270d95aacf39a4e432b4a7b2a/src/components/graph-view.js#L205-L210

Additional context After some tinkering I'm failing to realize which events I should handle. I would really appreciate any leads on:

https://github.com/uber/react-digraph/blob/4e89df837c233a9270d95aacf39a4e432b4a7b2a/src/components/graph-view.js#L908-L914

handleSvgClicked = (d: any, i: any) => {

...

if (this.state.selectingNode) {
  this.setState({
    focused: true,
    selectingNode: false,
    svgClicked: true,
});
cristianocca commented 4 years ago

I'm looking for this as well, have you been able to resolve the issue?