Browse Source

Add option to freez popups (Alt + Ctrl + F)

pull/6191/head
Luis von der Eltz 5 years ago
parent
commit
2387e0bb5a
  1. 7
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs
  2. 17
      src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs

7
src/Avalonia.Diagnostics/Diagnostics/ViewModels/MainViewModel.cs

@ -21,6 +21,7 @@ namespace Avalonia.Diagnostics.ViewModels
private bool _shouldVisualizeMarginPadding = true;
private bool _shouldVisualizeDirtyRects;
private bool _showFpsOverlay;
private bool _freezePopups;
#nullable disable
// Remove "nullable disable" after MemberNotNull will work on our CI.
@ -40,6 +41,12 @@ namespace Avalonia.Diagnostics.ViewModels
Console = new ConsoleViewModel(UpdateConsoleContext);
}
public bool FreezePopups
{
get => _freezePopups;
set => RaiseAndSetIfChanged(ref _freezePopups, value);
}
public bool ShouldVisualizeMarginPadding
{
get => _shouldVisualizeMarginPadding;

17
src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using Avalonia.Controls;
using Avalonia.Controls.Diagnostics;
using Avalonia.Controls.Primitives;
@ -173,6 +174,22 @@ namespace Avalonia.Diagnostics.Views
break;
}
case RawInputModifiers.Control | RawInputModifiers.Alt when e.Key == Key.F:
{
vm.FreezePopups = !vm.FreezePopups;
foreach (var popupRoot in GetPopupRoots(Root))
{
if (popupRoot.Parent is Popup popup)
{
popup.IsLightDismissEnabled = !vm.FreezePopups;
}
}
break;
}
case RawInputModifiers.Alt when e.Key == Key.S || e.Key == Key.D:
{
vm.EnableSnapshotStyles(e.Key == Key.S);

Loading…
Cancel
Save