Skip to content
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

Sigma stops propagating "mousemove" events even when not dragging anything #1148

Closed
jacomyal opened this issue Oct 29, 2021 · 1 comment
Closed
Labels
Milestone

Comments

@jacomyal
Copy link
Owner

I have an application with a sigma component and a react-sortable-hoc component next to each other.

I cannot drag elements from the react-sortable-hoc component over the sigma component, and this feels like a bug.

The reason is the following code:

if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
e.stopPropagation();
return false;

I can see two different solutions:

  1. Only execute the code above when the stage is being dragged
  2. Add settings that determine whether or not this code should execute
  3. Both

The issue I have with the solution 1. alone, is that in some cases there might be other interactions (like nodes drag-and-dropping) that require this code to be executed. Any thought on that @Yomguithereal?

@jacomyal jacomyal added the bug label Oct 29, 2021
@jacomyal
Copy link
Owner Author

By the way, there is also another behaviour that could be improved: The "mousemove" event is only dispatched on sigma's mouse DOM container, so when the user grabs the graph then moves the mouse out of the graph, it stops dragging.

jacomyal added a commit that referenced this issue Nov 23, 2021
Details:
- Binds mouse events to document instead of container
- Computes mouse events positions using container offset and page
coordinates instead or directly offset coordinates
- Only prevent defaults on handleMouseMove when the stage is actually
being dragged
@jacomyal jacomyal added this to the v2.1.0 milestone Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant