-
Notifications
You must be signed in to change notification settings - Fork 635
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
Node AutoLayout #11164
Node AutoLayout #11164
Conversation
// Placing the new node to the left of initial node | ||
var adjustedX = initialNode.X - 200; | ||
dynamoViewModel.ExecuteCommand(new DynamoModel.CreateAndConnectNodeCommand(id, portModel.Owner.GUID, | ||
nodeCreationName, 0, portModel.Index, adjustedX, adjustedY, false, false)); |
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.
Can we split this step into a CreateNodeCommand
step and then add a new command called something like PlaceAndConnectCommand
? That way we can first create the new node, get its height and width, and use the height and width to place it relative to the original node. In other words, the PlaceAndConnectCommand
will be a combination of 2 steps: 1) place the node based on a calculated X and Y position, and 2) call the
MakeConnectionCommand
. This way we might be able to do away with these hard-coded values.
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.
@aparajit-pratap I did thought about that before implementation but the height and width for the new nodes are always default to 100 for node model so not really useful to get the actual height and width
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.
@aparajit-pratap This is what I am referring to. I already considered this solution before finalizing the PR. For now there isn't a way I can see we can get the actual height and width for the newly placed node.
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.
Another slightly less important reason is about undo/redo, the current implementation only requires one undo to get back to the previous state versus the split way will need to be done by two undos.
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'm trying something else, will get back to you on this PR, I may commit directly to this PR if I can get something working.
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.
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.
Indeed, placing any slider or any giant node will result in such problem but I dont see a way to be smarter yet..
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.
@QilongTang I think we can close this PR :)
Please Note:
DynamoRevit
repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTM
label is added to the PR.Purpose
Auto layout the newly created node from node auto complete.
Instead of the existing auto layout algorithm we are using for clean up layout which makes the initial node jumpy, I am simply putting the new node right next to the input port and arrange some Y offset based on inputport index.
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@DynamoDS/dynamo
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of