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

"free" event doesn't fire if u right click during drag and drop #3005

Open
Ciappone opened this issue Mar 28, 2022 · 9 comments
Open

"free" event doesn't fire if u right click during drag and drop #3005

Ciappone opened this issue Mar 28, 2022 · 9 comments
Assignees
Labels
bug A bug in the code of Cytoscape.js pinned A long-lived issue, such as a discussion

Comments

@Ciappone
Copy link

Environment info

  • Cytoscape.js version : 3.20.0
  • Browser/Node.js & version : Google Chrome v. 99

Current (buggy) behaviour

as per title, if you right click with mouse during drag and drop, the node will be set free without firing the event "free".

Desired behaviour

the free event should be fired aniway

Minimum steps to reproduce

start dragging a node e right click before drop.

@Ciappone Ciappone added the bug A bug in the code of Cytoscape.js label Mar 28, 2022
@stale
Copy link

stale bot commented Apr 11, 2022

This issue has been automatically marked as stale, because it has not had activity within the past 14 days. It will be closed if no further activity occurs within the next 7 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

@stale stale bot added the stale label Apr 11, 2022
@stale stale bot closed this as completed Apr 18, 2022
@maxkfranz
Copy link
Member

Please provide a reproducible test case according to the issue template, including a code sample that reproduces the issue. A JSBin can be forked to easily provide a code sample. You may want to log events or show them in a div and demonstrate how they may violate your expectations.

A GIF or video would also help

@maxkfranz maxkfranz reopened this Apr 20, 2022
@stale stale bot removed the stale label Apr 20, 2022
@stale
Copy link

stale bot commented May 5, 2022

This issue has been automatically marked as stale, because it has not had activity within the past 14 days. It will be closed if no further activity occurs within the next 7 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

@stale stale bot added the stale label May 5, 2022
@Ciappone
Copy link
Author

Ciappone commented May 5, 2022

as you asked, I created a simple example that can reproduce the problem, you can find it here JSBin.

as you can see, if you drag and free a node, it will log on the left using the event cy.on("free",...), but if you right click during the drag, the node will be freed without firing the above-mentioned event ( and so it won't log ).

hope it can be of any help

@stale stale bot removed the stale label May 5, 2022
@maxkfranz
Copy link
Member

I tried your demo. It seems like there's the assumption that the user is cancelling the gesture by pressing the right mouse button. So, the node isn't explicitly freed by the user. So, there's a few things to consider:

(1) There's not currently a cancellation event for dragging. It's not clear that cancelling should be the same event as a user-intended 'free' event. If it's always the same event, how do you tell the difference?

(2) When the cancellation occurs should be carefully considered. It could be on the second button's 'mousedown' or on its 'mouseup'.

(3) Cancellation doesn't seem to be possible on some devices, like the on the Mac trackpad. An analogous case may be pressing with a second finger on touch devices, like the iPad.

(4) Given that this seems to be a request for some sort of new drag cancelling support with new events -- see (1) -- this may be something that should be planned as a new feature rather than as something included in a patch release.

(5) There's accessibility to consider. It could be that we shouldn't support cancellation at all. If someone isn't very dextrous with a mouse, it's easy to accidentally hit the extra right mouse button while dragging. In that case, it might be better to ignore the right mouse button rather than cancelling. As in (3), if we go this way, the behaviour should be made consistent for touch device users.

@Ciappone
Copy link
Author

Thanks for your considerations, do you think this behavior can be fixed in an upcoming release, as you explained in (5)?

@stale
Copy link

stale bot commented May 27, 2022

This issue has been automatically marked as stale, because it has not had activity within the past 14 days. It will be closed if no further activity occurs within the next 7 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

@stale stale bot added the stale label May 27, 2022
@stale stale bot closed this as completed Jun 3, 2022
@maxkfranz maxkfranz reopened this Jun 7, 2022
@maxkfranz
Copy link
Member

Let’s simplify this to consider only the mouse events. The touch case is more complex, and it seems qualitatively different after some analysis.

So, basically the new behaviour would be this: If we’re in the middle of a desktop (i.e. mouse) drag gesture, then all right mouse button events should be ignored.

@maxkfranz
Copy link
Member

@chrtannus, would you take a look at this one?

@maxkfranz maxkfranz added the pinned A long-lived issue, such as a discussion label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in the code of Cytoscape.js pinned A long-lived issue, such as a discussion
Projects
None yet
Development

No branches or pull requests

3 participants