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

tryToConnectNodes implementation #177

Open
rachel-fenichel opened this issue Jan 24, 2025 · 0 comments
Open

tryToConnectNodes implementation #177

rachel-fenichel opened this issue Jan 24, 2025 · 0 comments

Comments

@rachel-fenichel
Copy link
Contributor

Navigation.tryToConnectNodes takes in two nodes: a moving node and a stationary one. Those nodes may map to any valid ASTNode location.

What should happen when trying to connect nodes of various types?

Impossible moving nodes

If the moving node is anything other than a block, connection, or comment, it's not allowed to move. Error, because entering this function is a bad state.

Connection to connection

Call ConnectionChecker.canConnect(first, second, false) to make sure the connection is legal.
If legal, connect.
If illegal, warn and put the moving connection's block back where it came from.
Set the cursor position to the moving node.

Block to workspace

If the moving block was previously connected, disconnect it.
Move the block to the workspace at the location specified by the workspace node.

Block to connection

Check if any connection on the moving block is compatible with the stationary connection.
If yes, disconnect the moving block from its parent (if necessary) and connect it to the stationary connection.
If no, warn and put the moving block back where it came from.
Set the cursor position to the moving block.

Block to block

???

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

No branches or pull requests

1 participant