From ee5abdbf1d3546b17521ff0e87b3737b14b172b1 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 22 Jun 2021 02:48:55 -0400 Subject: [PATCH 1/3] Adjust the X-axis position for Node-Autocompletion elements. --- .../ViewModels/Search/NodeSearchElementViewModel.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs index b4e90f7e150..86802475d9b 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs @@ -268,6 +268,7 @@ protected virtual void CreateAndConnectToPort(object parameter) var id = Guid.NewGuid(); var adjustedX = initialNodeVm.X; + var adjustedY = initialNodeVm.Y; var createAsDownStreamNode = portModel.PortType == PortType.Output; // Placing the new node based on which port it is connecting to. @@ -278,16 +279,22 @@ protected virtual void CreateAndConnectToPort(object parameter) // Create a new node based on node creation name and connection ports dynamoViewModel.ExecuteCommand(new DynamoModel.CreateAndConnectNodeCommand(id, initialNode.GUID, - Model.CreationName, 0, Model.AutoCompletionNodeElementInfo.PortToConnect, adjustedX, 0, createAsDownStreamNode, false, true)); + Model.CreationName, 0, Model.AutoCompletionNodeElementInfo.PortToConnect, adjustedX, adjustedY, createAsDownStreamNode, false, true)); } else { // Placing the new node to the left of initial node adjustedX -= initialNode.Width + 50; + // If the new node is a input slider node, adjust the position on X-axis to compensate for higher width of the slider node. + if (Model.CreationName.Contains("Slider")) + { + adjustedX -= 450; + } + // Create a new node based on node creation name and connection ports dynamoViewModel.ExecuteCommand(new DynamoModel.CreateAndConnectNodeCommand(id, initialNode.GUID, - Model.CreationName, 0, portModel.Index, adjustedX, 0, createAsDownStreamNode, false, true)); + Model.CreationName, 0, portModel.Index, adjustedX, adjustedY, createAsDownStreamNode, false, true)); } var inputNodes = initialNode.InputNodes.Values.Where(x => x != null).Select(y => y.Item2); From 0b1ae1590f0d6ddf29a6ae3ee7ff67f39c36e187 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 22 Jun 2021 03:19:17 -0400 Subject: [PATCH 2/3] Comments --- .../ViewModels/Search/NodeSearchElementViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs index 86802475d9b..83ce802b221 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs @@ -286,7 +286,7 @@ protected virtual void CreateAndConnectToPort(object parameter) // Placing the new node to the left of initial node adjustedX -= initialNode.Width + 50; - // If the new node is a input slider node, adjust the position on X-axis to compensate for higher width of the slider node. + // If the new node is a slider input node, adjust the position on X-axis to compensate for higher width of the slider node. if (Model.CreationName.Contains("Slider")) { adjustedX -= 450; From 26c01899fef1e740183b1a596a12514db265d0f2 Mon Sep 17 00:00:00 2001 From: reddyashish <43763136+reddyashish@users.noreply.github.com> Date: Tue, 22 Jun 2021 13:20:15 -0400 Subject: [PATCH 3/3] some comments --- .../ViewModels/Search/NodeSearchElementViewModel.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs index 83ce802b221..48cdec5ae9c 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs @@ -25,6 +25,8 @@ public class NodeSearchElementViewModel : ViewModelBase, ISearchEntryViewModel private bool isSelected; private SearchViewModel searchViewModel; private IDisposable undoRecorderGroup; + private int spacingBetweenNodes = 50; + private int spacingforHigherWidthNodes = 450; public event RequestBitmapSourceHandler RequestBitmapSource; public void OnRequestBitmapSource(IconRequestEventArgs e) @@ -275,7 +277,7 @@ protected virtual void CreateAndConnectToPort(object parameter) if (createAsDownStreamNode) { // Placing the new node to the right of initial node - adjustedX += initialNode.Width + 50; + adjustedX += initialNode.Width + spacingBetweenNodes; // Create a new node based on node creation name and connection ports dynamoViewModel.ExecuteCommand(new DynamoModel.CreateAndConnectNodeCommand(id, initialNode.GUID, @@ -284,12 +286,12 @@ protected virtual void CreateAndConnectToPort(object parameter) else { // Placing the new node to the left of initial node - adjustedX -= initialNode.Width + 50; + adjustedX -= initialNode.Width + spacingBetweenNodes; // If the new node is a slider input node, adjust the position on X-axis to compensate for higher width of the slider node. if (Model.CreationName.Contains("Slider")) { - adjustedX -= 450; + adjustedX -= spacingforHigherWidthNodes; } // Create a new node based on node creation name and connection ports