-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Prevents incorrect connection attempt on port clicking in GraphEdit #40112
Prevents incorrect connection attempt on port clicking in GraphEdit #40112
Conversation
Prevents incorrect connection attempt on port clicking in GraphEdit
Will review now. |
Blackbox testing shows that the distance drags works. Will review the code. |
@@ -93,6 +93,8 @@ class GraphEdit : public Control { | |||
String connecting_target_to; | |||
int connecting_target_index; | |||
bool just_disconnected; | |||
bool connecting_valid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another pr initialize these variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested in Visual Script and Visual Shaders.
SWAP(from_slot, to_slot); | ||
} | ||
emit_signal("connection_request", from, from_slot, to, to_slot); | ||
if (connecting_valid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of nesting deeper, I use continue or return. Aka return early coding. https://softwareengineering.stackexchange.com/questions/18454/should-i-return-from-a-function-early-or-use-an-if-statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I know but the lines below 540 should also proceed in that if
statement, so this prevents code duplication.
Thanks! |
This will prevent the new node dialog from the show if the user simply clicks on port:
Now, this dialog will show only if the user drags connection to a small distance (same for actual connection with other port):