实际尺寸之间转换

This commit is contained in:
艾竹
2023-02-11 22:20:24 +08:00
parent 86082cb788
commit 59bfed341d
14 changed files with 487 additions and 265 deletions

View File

@@ -51,13 +51,13 @@ namespace AIStudio.Wpf.DiagramDesigner
if (designerbase is DesignerItemBase designer)
{
this.Left = designer.Left;
this.Top = designer.Top;
this.PhysicalLeft = designer.PhysicalLeft;
this.PhysicalTop = designer.PhysicalTop;
this.Angle = designer.Angle;
this.ScaleX = designer.ScaleX;
this.ScaleY = designer.ScaleY;
this.ItemWidth = designer.ItemWidth;
this.ItemHeight = designer.ItemHeight;
this.PhysicalItemWidth = designer.PhysicalItemWidth;
this.PhysicalItemHeight = designer.PhysicalItemHeight;
this.Icon = designer.Icon;
}
}
@@ -191,12 +191,10 @@ namespace AIStudio.Wpf.DiagramDesigner
set
{
if (value <= 0) return;
if (this is GroupDesignerItemViewModel && value < 70)
if (SetProperty(ref _itemWidth, value))
{
RaisePropertyChanged(nameof(PhysicalItemWidth));
}
SetProperty(ref _itemWidth, value);
}
}
@@ -212,7 +210,36 @@ namespace AIStudio.Wpf.DiagramDesigner
set
{
if (value <= 0) return;
SetProperty(ref _itemHeight, value);
if (SetProperty(ref _itemHeight, value))
{
RaisePropertyChanged(nameof(PhysicalItemHeight));
}
}
}
[Browsable(true)]
public double PhysicalItemWidth
{
get
{
return ItemWidth * (Root?.ScreenScale ?? 1d);
}
set
{
ItemWidth = value / (Root?.ScreenScale ?? 1d);
}
}
[Browsable(true)]
public double PhysicalItemHeight
{
get
{
return ItemHeight * (Root?.ScreenScale ?? 1d);
}
set
{
ItemHeight = value / (Root?.ScreenScale ?? 1d);
}
}
@@ -310,6 +337,32 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
[Browsable(true)]
public double PhysicalLeft
{
get
{
return Left * (Root?.ScreenScale ?? 1d);
}
set
{
Left = value / (Root?.ScreenScale ?? 1d);
}
}
[Browsable(true)]
public double PhysicalTop
{
get
{
return Top * (Root?.ScreenScale ?? 1d);
}
set
{
Top = value / (Root?.ScreenScale ?? 1d);
}
}
public PointBase Position
{
get