mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-05 04:39:08 +08:00
[FancyZones editor] Fix CanvasRect not being initialized (#10163)
* Fix CanvasRect not being initialized * No need to use workArea height if it's set in CanvasLayoutModel
This commit is contained in:
parent
72da703f0e
commit
488ee19f93
@ -261,7 +261,7 @@ namespace FancyZonesEditor
|
||||
private void RenderCanvasPreview(CanvasLayoutModel canvas)
|
||||
{
|
||||
var workArea = canvas.CanvasRect;
|
||||
if (workArea.Width == 0 || workArea.Height == 0 || App.Overlay.SpanZonesAcrossMonitors)
|
||||
if (workArea.Width == 0 || workArea.Height == 0)
|
||||
{
|
||||
workArea = App.Overlay.WorkArea;
|
||||
}
|
||||
|
@ -304,7 +304,8 @@ namespace FancyZonesEditor
|
||||
}
|
||||
else
|
||||
{
|
||||
CanvasLayoutModel canvasModel = new CanvasLayoutModel(LayoutNameText.Text, LayoutType.Custom);
|
||||
var area = App.Overlay.WorkArea;
|
||||
CanvasLayoutModel canvasModel = new CanvasLayoutModel(LayoutNameText.Text, LayoutType.Custom, (int)area.Width, (int)area.Height);
|
||||
canvasModel.AddZone();
|
||||
selectedLayoutModel = canvasModel;
|
||||
}
|
||||
|
@ -36,6 +36,12 @@ namespace FancyZonesEditor.Models
|
||||
CanvasRect = new Rect(new Size(width, height));
|
||||
}
|
||||
|
||||
public CanvasLayoutModel(string name, LayoutType type, int width, int height)
|
||||
: base(name, type)
|
||||
{
|
||||
CanvasRect = new Rect(new Size(width, height));
|
||||
}
|
||||
|
||||
public CanvasLayoutModel(string name, LayoutType type)
|
||||
: base(name, type)
|
||||
{
|
||||
@ -148,6 +154,7 @@ namespace FancyZonesEditor.Models
|
||||
}
|
||||
|
||||
layout.SensitivityRadius = SensitivityRadius;
|
||||
layout.CanvasRect = CanvasRect;
|
||||
return layout;
|
||||
}
|
||||
|
||||
@ -161,6 +168,7 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
other._topLeft = _topLeft;
|
||||
other.SensitivityRadius = SensitivityRadius;
|
||||
other.CanvasRect = CanvasRect;
|
||||
other.UpdateLayout();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user