Skip to content

New: Added support to set node/edge state using custom options #71

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
wants to merge 1 commit into
base: release/1.0.0
Choose a base branch
from

Conversation

parmar-abhinav
Copy link

@parmar-abhinav parmar-abhinav commented Jul 23, 2023

Issue id: #68

Description:
This pull request introduces the mechanism for handling state changes of nodes and edges through the setState method in the Node and Edge classes. Additionally, this enhancement includes optional parameters such as isToggle and isSingle in the setState method, providing greater customization for handling state updates.

Examples:

// Select the node
node.setState({ state: SELECTED });

// Select the node if not selected, otherwise unselect it
node.setState({ state: SELECTED, options: { isToggle: true }});

// Select the node, but unselect any other node that is currently selected (aka only the single node will be selected)
node.setState({ state: SELECTED, options: { isSingle: true }});

@parmar-abhinav
Copy link
Author

This PR contain only one part of the 2 task mentioned in the issue. Implementing setState method in this PR. Thinking of raising separate PR for the task:

The ORB should have a structure to keep nodes/edges by their state (selected, hovered, or even custom user ones - that is the reason why the state can be any number) - this is for easier and faster lookup, currently, you need to iterate through all nodes/edges to get the selected/hovered one which is not an optimal way

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.

2 participants