Skip to content

Enable line selection when start or end point is within box selection #3359

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

Open
4 tasks
jquery404 opened this issue Apr 6, 2025 · 3 comments
Open
4 tasks

Comments

@jquery404
Copy link
Contributor

jquery404 commented Apr 6, 2025

Box selection should select lines with partially selected endpoints

Description:
⚠️ Cytoscape only checks if both (start and end points) or all endpoints (in the case of haystacks) are inside the user selection box to consider it selected.

Example of the issue:

Motivation for new feature
Users can only select lines when both endpoints fall within the selection box. This limits usability, especially when working with complex diagrams or densely connected nodes, where selecting precise points is difficult.

Proposed Solution:
✅ We bypass that by checking if at least one (start or end point) is inside the user selection box, which then selects the lines as well as the associated connected lines attached to that point.

📸 Demo:

cc: @maxkfranz

For reviewers

Reviewers should ensure that the following tasks are carried out for incorporated issues:

  • Ensure that the reporter has adequately described their idea. If not, elicit more information about the use case. You should iteratively build a spec together.
  • Ensure that the issue is a good fit for the core library. Some things are best done in extensions (e.g. UI-related features that aren't style-related). Some things are best done by app authors themselves -- instead of in Cytoscape libraries.
  • The issue has been associated with a corresponding milestone.
  • The commits have been incorporated into the unstable branch via pull request. The corresponding pull request is cross-referenced.
@maxkfranz
Copy link
Member

maxkfranz commented Apr 9, 2025

What do you think about making the feature a bit more general, i.e.

box-selection: contain | overlap | none

The box selection mode for an element; may be contain (completely inside the box), overlap (overlaps with the box), or none (box selection disabled)

That way, it could be applied to nodes, edges, or both.

@maxkfranz
Copy link
Member

Edit: A third useful value would be none to disable it for a particular element, e.g. maybe you don't want to allow box selection for edges at all

@jquery404
Copy link
Contributor Author

jquery404 commented Apr 25, 2025

@maxkfranz, thanks for the suggestions. I have updated the PR, the default value is set to box-selection: contain which is more or less the current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants