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

Provide Functions that Support Dragging Nodes to New Positions #24

Open
pjlamb12 opened this issue Dec 2, 2020 · 1 comment
Open

Provide Functions that Support Dragging Nodes to New Positions #24

pjlamb12 opened this issue Dec 2, 2020 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pjlamb12
Copy link
Collaborator

pjlamb12 commented Dec 2, 2020

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

There is no function that supports dragging a node to a new position in the model, or moving an existing node from one location to another in the model

Expected behavior

There should be a function that allows you to pass in a step ID for an existing step and its new location. The function would then rearrange the model with the node in the updated location. There could be an option to include its children when moving, or to only move the one node.

If the children are included, then every node that comes after the location that the node is moved to will have to be potentially updated as well. If it's just the one node, and its previous children stay, then the moving node and its previous children will have to be updated.

For example, let's say we want to move node 3:

1 → 2 → 3 would change to 1 → 3 → 2
Or
1 → 2 → 3 → 4 would change to 1 → 3 → 2 → 4 OR 1 → 3 → 4 → 2

In the second example there, with the four nodes, the desired result depends on if the node's children should be moved or not as well.

This gets more complicated as branches are introduced. If a node is being moved:

  • and it has branch siblings, then the branch siblings would likely stay, but be updated (since their sibling has left).
  • and it is moved to be a child of another parent that already has at least one child (creating multiple branches from one parent) then the branch numbers should be updated properly for all siblings
  • and its children are coming along, and those children have a branch, then all nodes after the last child of the node being moved should be set as children of branchPath 1 (this one is definitely more complex)

Take this model:

1
2

3 4

If we are moving node 2 and its branched children up above 1, it should end like this:

2

3 4
1

In this case, node 1 is just updated to be a child of branchPath 1. If only node 2 is moved and not its children, then it would end up like this:

2
1

3 4

And nodes 3 and 4 should be updated to have node 1 be their parent Id, and not node 2.

What is the motivation / use case for changing the behavior?

Some UIs will want to implement drag and drop, and this will help enable it. The service itself won't implement the drag and drop necessarily, unless in the future a component that displays the model is provided and handles drag and drop and stuff like that.

@pjlamb12 pjlamb12 added enhancement New feature or request help wanted Extra attention is needed labels Dec 2, 2020
@pjlamb12
Copy link
Collaborator Author

I think the insertNode and insertNodeAndRemoveOld functions can be used here in some capacity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant