mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
整理序列化
This commit is contained in:
@@ -18,12 +18,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
|
||||
public DesignerItemViewModelBase(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
public DesignerItemViewModelBase(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
{
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
|
||||
public DesignerItemViewModelBase(IDiagramViewModel parent, string json) : base(parent, json)
|
||||
public DesignerItemViewModelBase(IDiagramViewModel root, string json) : base(root, json)
|
||||
{
|
||||
ShapeDefiner = Shapes.Rectangle;
|
||||
}
|
||||
@@ -35,9 +35,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
InitConnector();
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel root, SelectableItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
base.LoadDesignerItemViewModel(root, designerbase);
|
||||
|
||||
DesignerItemBase designer = designerbase as DesignerItemBase;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
this.Icon = designer.Icon;
|
||||
}
|
||||
|
||||
public override SelectableDesignerItemBase ToXmlObject()
|
||||
public override SelectableItemBase ToXmlObject()
|
||||
{
|
||||
return new DesignerItemBase(this);
|
||||
}
|
||||
@@ -382,41 +382,41 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (!(this is TextDesignerItemViewModel))
|
||||
{
|
||||
if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Center)
|
||||
if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Center)
|
||||
{
|
||||
if (Parent.GridCellSize.Width > this.ItemWidth)
|
||||
if (Root.GridCellSize.Width > this.ItemWidth)
|
||||
{
|
||||
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width - this.ItemWidth) / 2;
|
||||
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin + (Root.GridCellSize.Width - this.ItemWidth) / 2;
|
||||
}
|
||||
}
|
||||
else if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Left)
|
||||
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Left)
|
||||
{
|
||||
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin;
|
||||
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin;
|
||||
}
|
||||
else if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Right)
|
||||
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Right)
|
||||
{
|
||||
if (Parent.GridCellSize.Width > this.ItemWidth)
|
||||
if (Root.GridCellSize.Width > this.ItemWidth)
|
||||
{
|
||||
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width - this.ItemWidth);
|
||||
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin + (Root.GridCellSize.Width - this.ItemWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (Parent.CellVerticalAlignment == CellVerticalAlignment.Center)
|
||||
if (Root.CellVerticalAlignment == CellVerticalAlignment.Center)
|
||||
{
|
||||
if (Parent.GridCellSize.Height > this.ItemHeight)
|
||||
if (Root.GridCellSize.Height > this.ItemHeight)
|
||||
{
|
||||
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height - this.ItemHeight) / 2;
|
||||
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin + (Root.GridCellSize.Height - this.ItemHeight) / 2;
|
||||
}
|
||||
}
|
||||
else if (Parent.CellVerticalAlignment == CellVerticalAlignment.Top)
|
||||
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Top)
|
||||
{
|
||||
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin;
|
||||
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin;
|
||||
}
|
||||
else if (Parent.CellVerticalAlignment == CellVerticalAlignment.Bottom)
|
||||
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Bottom)
|
||||
{
|
||||
if (Parent.GridCellSize.Height > this.ItemHeight)
|
||||
if (Root.GridCellSize.Height > this.ItemHeight)
|
||||
{
|
||||
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height - this.ItemHeight);
|
||||
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin + (Root.GridCellSize.Height - this.ItemHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user