Skip to content

Commit

Permalink
DYN-6176 Retain selected nodes/groups when dragging it into a group (#…
Browse files Browse the repository at this point in the history
…14986)

* add

* Update AnnotationViewModel.cs
  • Loading branch information
zeusongit authored Mar 6, 2024
1 parent 52ca824 commit 1beebe0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Utilities/CompactBubbleHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static CompactBubbleViewModel Process(MirrorData value)
{
items = 0;
var viewModel = ProcessThing(value, true);
viewModel.SetObjectType(value.Data);
viewModel.SetObjectType(value?.Data);
viewModel.NumberOfItems = items;

return viewModel;
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationMode

ViewModelBases = this.WorkspaceViewModel.GetViewModelsInternal(annotationModel.Nodes.Select(x => x.GUID));

// Add all grouped AnnotaionModels to the CutGeometryDictionary.
// Add all grouped AnnotationModels to the CutGeometryDictionary.
// And raise ZIndex changed to make sure nested groups have
// a higher zIndex than the parent.
using (NestedGroupsGeometries.DeferCollectionReset())
Expand Down
6 changes: 4 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ internal bool HandleMouseRelease(object sender, MouseButtonEventArgs e)
.ToList();

// AddModelsToGroupModelCommand adds models to the selected group
// therefor we add the dropGroup to the selection before calling
// therefore we add the dropGroup to the selection before calling
// the command.
DynamoSelection.Instance.Selection.AddUnique(dropGroup.AnnotationModel);

Expand Down Expand Up @@ -794,7 +794,9 @@ internal bool HandleMouseRelease(object sender, MouseButtonEventArgs e)
owningWorkspace.DynamoViewModel.AddModelsToGroupModelCommand.Execute(null);
}
dropGroup.NodeHoveringState = false;
dropGroup.SelectAll();
//select only those models which were added to the group
DynamoSelection.Instance.ClearSelection();
DynamoSelection.Instance.Selection.AddRange(modelsToAdd);
}

SetCurrentState(State.None); // Dragging operation ended.
Expand Down

0 comments on commit 1beebe0

Please sign in to comment.