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

Include Node Labels in Box Selection Area #3281

Open
jquery404 opened this issue Oct 4, 2024 · 1 comment
Open

Include Node Labels in Box Selection Area #3281

jquery404 opened this issue Oct 4, 2024 · 1 comment

Comments

@jquery404
Copy link

jquery404 commented Oct 4, 2024

Include Node Labels in Box Selection Area

Description:
Box selection doesn't select nodes if it only covers the node label without including the node itself.

Here is an example https://jsfiddle.net/jquery404/tfcvhm2s/ [try box-select on labels (a or b)]

Motivation for new feature
Currently, when the text-events: yes property is enabled, it allows for direct interaction (like click, tap) with node labels, but box selection only considers the node’s shape and padding, not the labels. In graphs where labels are positioned away from the node or have large text margins for readability, users naturally attempt to select nodes by drawing a selection box around the label area. However, this action does not currently select the node, leading to an unintuitive user experience.

Proposed Solution:

  • Allow an option to include labels in the node's interactive area for box selection, similar to how text-events: yes allows direct interaction with the label.
  • Example: A new style property like box-select-labels: yes to enable this behavior?

Use Case:
This feature would be valuable in scenarios where labels are positioned away from the node's center (e.g., large graphs where labels are shifted for readability). Including labels in the box selection area would make it more intuitive to select nodes based on their labels.

Possible Changes:

{
  name: 'box-select-labels',
  type: types.bool,
  triggersBounds: true
}

@maxkfranz
Copy link
Member

@jquery404, would you put up a PR with your proposed behaviour change but only using the existing text-events property?

If you have text-events:yes, it would be fair to assume that box selection would apply w.r.t. labels.

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