Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,10 @@ Dynamo.Controls.WorkspaceBackgroundColorConverter.CustomBackgroundColor.set -> v
Dynamo.Controls.WorkspaceBackgroundColorConverter.HomeBackgroundColor.get -> System.Windows.Media.Color
Dynamo.Controls.WorkspaceBackgroundColorConverter.HomeBackgroundColor.set -> void
Dynamo.Controls.WorkspaceBackgroundColorConverter.WorkspaceBackgroundColorConverter() -> void
Dynamo.Controls.WorkspaceContextMenuHeightConverter
Dynamo.Controls.WorkspaceContextMenuHeightConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.WorkspaceContextMenuHeightConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.WorkspaceContextMenuHeightConverter.WorkspaceContextMenuHeightConverter() -> void
Dynamo.Controls.WorkspaceTypeConverter
Dynamo.Controls.WorkspaceTypeConverter.Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Dynamo.Controls.WorkspaceTypeConverter.ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture) -> object
Expand Down
23 changes: 14 additions & 9 deletions src/DynamoCoreWpf/Utilities/NodeAutoCompleteUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,36 @@
using System.Linq;
using System.Windows;
using System.Windows.Threading;
using Dynamo.ViewModels;

namespace Dynamo.Wpf.Utilities
{
internal static class NodeAutoCompleteUtilities
{
// We want to perform an AutoLayout operation only after all nodes have updated their UI.
// Therefore, we will queue the AutoLayout operation to execute during the next idle event.
internal static void PostAutoLayoutNodes(WorkspaceModel wsModel,
internal static void PostAutoLayoutNodes(DynamoViewModel dynamoViewModel, WorkspaceModel wsModel,
NodeModel queryNode,
IEnumerable<NodeModel> misplacedNodes,
bool skipInitialAutoLayout,
bool checkWorkspaceNodes,
PortType portType,
Action finalizer)
{
if (Application.Current?.Dispatcher != null)

var dispatcher = dynamoViewModel?.UIDispatcher ?? Dispatcher.CurrentDispatcher;

if (dispatcher != null)
{
Application.Current.Dispatcher.BeginInvoke(() => AutoLayoutNodes(wsModel,
queryNode,
misplacedNodes,
skipInitialAutoLayout,
checkWorkspaceNodes,
portType,
finalizer), DispatcherPriority.ApplicationIdle);
dispatcher.BeginInvoke(() => AutoLayoutNodes(wsModel,
queryNode,
misplacedNodes,
skipInitialAutoLayout,
checkWorkspaceNodes,
portType,
finalizer), DispatcherPriority.ApplicationIdle);
}

}

internal static Rect2D GetNodesBoundingBox(IEnumerable<NodeModel> nodes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ protected virtual void CreateAndConnectToPort(object parameter)

Action ensureUndoGroup = () => undoRecorderGroup?.Dispose();

NodeAutoCompleteUtilities.PostAutoLayoutNodes(dynamoViewModel.CurrentSpace, initialNode, misplacedNodes, false, true, portModel.PortType, ensureUndoGroup);
NodeAutoCompleteUtilities.PostAutoLayoutNodes(dynamoViewModel, dynamoViewModel.CurrentSpace, initialNode, misplacedNodes, false, true, portModel.PortType, ensureUndoGroup);
}

protected virtual bool CanCreateAndConnectToPort(object parameter)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ internal void ConsolidateTransientNodes()
connector.IsTransient = false;
}

NodeAutoCompleteUtilities.PostAutoLayoutNodes(node.WorkspaceViewModel.Model, node.NodeModel, transientNodes.Select(x => x.NodeModel), true, true, PortViewModel.PortType, null);
NodeAutoCompleteUtilities.PostAutoLayoutNodes(dynamoViewModel, node.WorkspaceViewModel.Model, node.NodeModel, transientNodes.Select(x => x.NodeModel), true, true, PortViewModel.PortType, null);

if (PortViewModel.PortType == PortType.Input)
{
Expand Down Expand Up @@ -983,7 +983,7 @@ internal void AddCluster(ClusterResultItem clusterResultItem)
}

// Perform auto-layout for the newly added nodes
NodeAutoCompleteUtilities.PostAutoLayoutNodes(
NodeAutoCompleteUtilities.PostAutoLayoutNodes(dynamoViewModel,
workspaceViewModel.DynamoViewModel.CurrentSpace,
PortViewModel.NodeViewModel.NodeModel,
createdNodes.Values,
Expand Down
Loading