mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-08 01:52:52 +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)
|
private void RenderCanvasPreview(CanvasLayoutModel canvas)
|
||||||
{
|
{
|
||||||
var workArea = canvas.CanvasRect;
|
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;
|
workArea = App.Overlay.WorkArea;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,8 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
else
|
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();
|
canvasModel.AddZone();
|
||||||
selectedLayoutModel = canvasModel;
|
selectedLayoutModel = canvasModel;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,12 @@ namespace FancyZonesEditor.Models
|
|||||||
CanvasRect = new Rect(new Size(width, height));
|
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)
|
public CanvasLayoutModel(string name, LayoutType type)
|
||||||
: base(name, type)
|
: base(name, type)
|
||||||
{
|
{
|
||||||
@ -148,6 +154,7 @@ namespace FancyZonesEditor.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
layout.SensitivityRadius = SensitivityRadius;
|
layout.SensitivityRadius = SensitivityRadius;
|
||||||
|
layout.CanvasRect = CanvasRect;
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +168,7 @@ namespace FancyZonesEditor.Models
|
|||||||
|
|
||||||
other._topLeft = _topLeft;
|
other._topLeft = _topLeft;
|
||||||
other.SensitivityRadius = SensitivityRadius;
|
other.SensitivityRadius = SensitivityRadius;
|
||||||
|
other.CanvasRect = CanvasRect;
|
||||||
other.UpdateLayout();
|
other.UpdateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user