mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Implement canceling edits in FZE, fix crashes related to canceling. (#1610)
* Implemented proper canceling for CanvasEditor * Implemented proper canceling for GridEditor * Possible fix for a crash in my implementation of canceling * Fixed a crash in FZE/Grid editor
This commit is contained in:
@@ -113,6 +113,15 @@ namespace FancyZonesEditor.Models
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void RestoreTo(CanvasLayoutModel other)
|
||||
{
|
||||
other.Zones.Clear();
|
||||
foreach (Int32Rect zone in Zones)
|
||||
{
|
||||
other.Zones.Add(zone);
|
||||
}
|
||||
}
|
||||
|
||||
// PersistData
|
||||
// Implements the LayoutModel.PersistData abstract method
|
||||
protected override void PersistData()
|
||||
|
||||
@@ -131,6 +131,12 @@ namespace FancyZonesEditor.Models
|
||||
public override LayoutModel Clone()
|
||||
{
|
||||
GridLayoutModel layout = new GridLayoutModel(Name);
|
||||
RestoreTo(layout);
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void RestoreTo(GridLayoutModel layout)
|
||||
{
|
||||
int rows = Rows;
|
||||
int cols = Columns;
|
||||
|
||||
@@ -163,8 +169,6 @@ namespace FancyZonesEditor.Models
|
||||
}
|
||||
|
||||
layout.ColumnPercents = colPercents;
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
// PersistData
|
||||
|
||||
Reference in New Issue
Block a user