Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,6 @@ private void model_PropertyChanged(object sender, System.ComponentModel.Property
RaisePropertyChanged("Width");
RaisePropertyChanged(nameof(ModelAreaRect));
UpdateAllGroupedGroups();
RedrawConnectors(false);
break;
case "Height":
RaisePropertyChanged("Height");
Expand Down
30 changes: 14 additions & 16 deletions src/DynamoCoreWpf/Views/Core/AnnotationView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,8 @@ private void AnnotationView_Loaded(object sender, RoutedEventArgs e)
}
ViewModel.UpdateProxyPortsPosition();

// Create and attach the popup menu for group annotations
CreateAndAttachAnnotationPopup();

// Subscribe to search box activity to close the other popup items when typing
var searchVM = ViewModel.WorkspaceViewModel.InCanvasSearchViewModel;
searchVM.PropertyChanged += OnSearchViewModelPropertyChanged;

// Add new nodes to group when search is triggered from group
ViewModel.WorkspaceViewModel.Nodes.CollectionChanged += OnWorkspaceNodesChanged;

// Reset group context flag when popup closes
_groupContextMenuClosedHandler = (s, e) => isSearchFromGroupContext = false;
GroupContextMenuPopup.Closed += _groupContextMenuClosedHandler;
}
}

Expand Down Expand Up @@ -434,11 +423,8 @@ private void AnnotationView_OnMouseRightButtonDown(object sender, MouseButtonEve
/// </summary>
private void AnnotationView_OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
if (!GroupContextMenuPopup.IsOpen)
{
OpenContextMenuAtMouse();
e.Handled = true;
}
OpenContextMenuAtMouse();
e.Handled = true;
}

/// <summary>
Expand Down Expand Up @@ -666,6 +652,9 @@ private void GroupDescriptionControls_SizeChanged(object sender, SizeChangedEven

private void OpenContextMenuAtMouse()
{
// Create and attach the popup menu for group annotations
CreateAndAttachAnnotationPopup();

var workspaceView = WpfUtilities.FindParent<WorkspaceView>(this);
if (workspaceView == null) return;

Expand Down Expand Up @@ -1786,6 +1775,9 @@ private Border CreateNodeCountBorder()

private void CreateAndAttachAnnotationPopup()
{
// If the context menu is already created, no need to recreate or re-subscribe
if (GroupContextMenuPopup != null) return;

GroupContextMenuPopup = new Popup
{
Name = "AnnotationContextPopup",
Expand All @@ -1803,6 +1795,12 @@ private void CreateAndAttachAnnotationPopup()
};

GroupContextMenuPopup.Child = border;

// Subscribe to search box activity to close the other popup items when typing
var searchVM = ViewModel.WorkspaceViewModel.InCanvasSearchViewModel;
searchVM.PropertyChanged += OnSearchViewModelPropertyChanged;
_groupContextMenuClosedHandler = (s, e) => isSearchFromGroupContext = false;
GroupContextMenuPopup.Closed += _groupContextMenuClosedHandler;
}

private StackPanel CreatePopupPanel()
Expand Down
Loading