Skip to content

Alt + left click to Ungroup Target Group #13157

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

Merged
merged 1 commit into from
Aug 3, 2022
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
11 changes: 10 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3267,4 +3267,7 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="InvalidDraggingOperationMessgae" xml:space="preserve">
<value>Nothing is being dragged. If you see this message, most likely your recent Dynamo interaction is not recommended.</value>
</data>
<data name="UngroupParentGroupWarning" xml:space="preserve">
<value>Dynamo cannot ungroup when there is no parent group.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3254,4 +3254,7 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="InvalidDraggingOperationMessgae" xml:space="preserve">
<value>Nothing is being dragged. If you see this message, most likely your recent Dynamo interaction is not recommended.</value>
</data>
<data name="UngroupParentGroupWarning" xml:space="preserve">
<value>Dynamo cannot ungroup when there is no parent group.</value>
</data>
</root>
5 changes: 3 additions & 2 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ private void Popup_StepClosed(string name, Step.StepTypes stepType)
/// </summary>
/// <param name="content">The target content to display.</param>
/// TODO: Make this API out of guide manager to a more generic place
internal void CreateRealTimeInfoWindow(string content)
internal void CreateRealTimeInfoWindow(string content, bool stayOpen = false)
{
//Search a UIElement with the Name "statusBarPanel" inside the Dynamo VisualTree
UIElement hostUIElement = GuideUtilities.FindChild(mainRootElement, "statusBarPanel");
Expand All @@ -552,7 +552,8 @@ internal void CreateRealTimeInfoWindow(string content)
VerticalOffset = ExitTourVerticalOffset,
HorizontalOffset = ExitTourHorizontalOffset,
Placement = PlacementMode.Left,
TextContent = content
TextContent = content,
StaysOpen = stayOpen
};

if (hostUIElement != null)
Expand Down
23 changes: 22 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ private void InitiateDragSequence()
if (this.currentState != State.None)
throw new InvalidOperationException();

// Before setting the drag state,
// Before setting the drag state on node or note,
// Alt + left click triggers removal of group node or note belongs to
if (Keyboard.IsKeyDown(Key.LeftAlt) && !DynamoSelection.Instance.Selection.OfType<AnnotationModel>().Any())
{
Expand All @@ -1101,6 +1101,27 @@ private void InitiateDragSequence()
}
}

// Before setting the drag state on group
// Alt + left click triggers removal of group from parent group
if (Keyboard.IsKeyDown(Key.LeftAlt) && DynamoSelection.Instance.Selection.OfType<AnnotationModel>().Any())
{
var model = DynamoSelection.Instance.Selection.OfType<AnnotationModel>().FirstOrDefault();
{
var parentGroup = owningWorkspace.Annotations
.Where(x => x.AnnotationModel.ContainsModel(model))
.FirstOrDefault();
if (parentGroup != null)
{
// Only trigger when parent group exist
owningWorkspace.Annotations.Where(x => x.AnnotationModel.GUID == model.GUID).FirstOrDefault().RemoveGroupFromGroupCommand.Execute(null);
}
else
{
owningWorkspace.DynamoViewModel.MainGuideManager.CreateRealTimeInfoWindow(Wpf.Properties.Resources.UngroupParentGroupWarning, true);
}
}
}

SetCurrentState(State.DragSetup);
}

Expand Down