Skip to content

Commit

Permalink
Dyn 4964 popup geo scaling bugs (#13717)
Browse files Browse the repository at this point in the history
* DYN-4964-PopupGeoScaling-Bugs

Fixing the next bugs reported by Aabi:
- The Popup was not closing when clicking in the Dynamo workspace (adding a similar fix like the Workspace ContextMenu).
- Adding a shadow over the new Geometry Scaling popup icon.

* DYN-4964-WorkingRange-Popup Bug fixes

There was a missing case that when the user click a Dynamo menu the Popup was not closing then I added some extra code to close it.

* DYN-4964-WorkingRange-Popup Bug Code Review1

Removing extra trailing spaces.
  • Loading branch information
RobertGlobant20 authored and zeusongit committed Feb 6, 2023
1 parent a526390 commit 35005c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Dynamo.Search.SearchElements;
using Dynamo.Selection;
using Dynamo.UI;
using Dynamo.UI.Controls;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Wpf.UI;
Expand Down Expand Up @@ -196,6 +197,12 @@ private void ShowHideContextMenu(ShowHideFlags flag)
ShowHidePopup(flag, ContextMenuPopup);
}

private void ShowHideGeoScalingPopup(ShowHideFlags flag)
{
if (GeoScalingPopup != null)
ShowHidePopup(flag, GeoScalingPopup);
}

private void ShowHidePopup(ShowHideFlags flag, Popup popup)
{
// Reset popup display state
Expand Down Expand Up @@ -268,6 +275,13 @@ public void HideAllPopUp(object sender)
ShowHideContextMenu(ShowHideFlags.Hide);
ShowHideInCanvasControl(ShowHideFlags.Hide);
}

var imageButtonGeoScalingPopup = Mouse.DirectlyOver as ImageRepeatButton;
//When imageButtonGeoScalingPopup is null means that the user is clicking the Geometry Scaling button so we should not close the Popup
if (imageButtonGeoScalingPopup == null && GeoScalingPopup != null && GeoScalingPopup.IsOpen)
{
ShowHideGeoScalingPopup(ShowHideFlags.Hide);
}
// If triggered on node level, make sure node popups are also hidden
if(sender is NodeView && (PortContextMenu.IsOpen || NodeAutoCompleteSearchBar.IsOpen) )
{
Expand Down Expand Up @@ -712,6 +726,8 @@ private void OnCanvasMouseDown(object sender, MouseButtonEventArgs e)
{
ContextMenuPopup.IsOpen = false;
InCanvasSearchBar.IsOpen = false;
if (GeoScalingPopup != null)
GeoScalingPopup.IsOpen = false;

if(PortContextMenu.IsOpen) DestroyPortContextMenu();
}
Expand All @@ -734,6 +750,8 @@ private void OnMouseRelease(object sender, MouseButtonEventArgs e)

ViewModel.HandleMouseRelease(workBench, e);
ContextMenuPopup.IsOpen = false;
if (GeoScalingPopup != null)
GeoScalingPopup.IsOpen = false;
if (returnToSearch)
{
ViewModel.DynamoViewModel.CurrentSpaceViewModel.InCanvasSearchViewModel.OnRequestFocusSearch();
Expand Down

0 comments on commit 35005c3

Please sign in to comment.