mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
[FancyZones Editor] Reset layout (#8114)
Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
@@ -120,10 +120,16 @@ namespace FancyZonesEditor.Models
|
||||
{
|
||||
AddCustomLayout(this);
|
||||
|
||||
var canvasRect = CanvasRect;
|
||||
if (canvasRect.Width == 0 || canvasRect.Height == 0)
|
||||
{
|
||||
canvasRect = App.Overlay.WorkArea;
|
||||
}
|
||||
|
||||
CanvasLayoutInfo layoutInfo = new CanvasLayoutInfo
|
||||
{
|
||||
RefWidth = (int)CanvasRect.Width,
|
||||
RefHeight = (int)CanvasRect.Height,
|
||||
RefWidth = (int)canvasRect.Width,
|
||||
RefHeight = (int)canvasRect.Height,
|
||||
Zones = new Zone[Zones.Count],
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using FancyZonesEditor.Models;
|
||||
|
||||
namespace FancyZonesEditor
|
||||
@@ -16,8 +17,6 @@ namespace FancyZonesEditor
|
||||
|
||||
public static int DefaultSensitivityRadius => 20;
|
||||
|
||||
public string DeviceId { get; set; } = string.Empty;
|
||||
|
||||
public string ZonesetUuid { get; set; } = string.Empty;
|
||||
|
||||
public LayoutType Type { get; set; } = LayoutType.PriorityGrid;
|
||||
|
||||
@@ -46,9 +46,6 @@ namespace FancyZonesEditor
|
||||
public static readonly string RegistryPath = "SOFTWARE\\SuperFancyZones";
|
||||
public static readonly string FullRegistryPath = "HKEY_CURRENT_USER\\" + RegistryPath;
|
||||
|
||||
private const string LayoutTypeBlankStr = "blank";
|
||||
private const string NullUuidStr = "null";
|
||||
|
||||
// hard coded data for all the "Priority Grid" configurations that are unique to "Grid"
|
||||
private static readonly byte[][] _priorityData = new byte[][]
|
||||
{
|
||||
@@ -364,6 +361,16 @@ namespace FancyZonesEditor
|
||||
|
||||
private static ObservableCollection<LayoutModel> _customModels;
|
||||
|
||||
public CanvasLayoutModel BlankModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _blankModel;
|
||||
}
|
||||
}
|
||||
|
||||
private CanvasLayoutModel _blankModel = new CanvasLayoutModel(string.Empty, LayoutType.Blank);
|
||||
|
||||
public static bool IsPredefinedLayout(LayoutModel model)
|
||||
{
|
||||
return model.Type != LayoutType.Custom;
|
||||
@@ -379,7 +386,11 @@ namespace FancyZonesEditor
|
||||
LayoutSettings currentApplied = App.Overlay.CurrentLayoutSettings;
|
||||
|
||||
// set new layout
|
||||
if (currentApplied.Type == LayoutType.Custom)
|
||||
if (currentApplied.Type == LayoutType.Blank)
|
||||
{
|
||||
foundModel = BlankModel;
|
||||
}
|
||||
else if (currentApplied.Type == LayoutType.Custom)
|
||||
{
|
||||
foreach (LayoutModel model in MainWindowSettingsModel.CustomModels)
|
||||
{
|
||||
@@ -406,7 +417,7 @@ namespace FancyZonesEditor
|
||||
|
||||
if (foundModel == null)
|
||||
{
|
||||
foundModel = DefaultModels[0];
|
||||
foundModel = DefaultModels[4]; // PriorityGrid
|
||||
}
|
||||
|
||||
foundModel.IsSelected = true;
|
||||
|
||||
Reference in New Issue
Block a user