DiagramOption LayoutOption 参数整理

This commit is contained in:
kwai
2023-05-11 19:14:39 +08:00
parent 2045c5e45c
commit f995722828
51 changed files with 589 additions and 637 deletions

View File

@@ -601,41 +601,41 @@ namespace AIStudio.Wpf.DiagramDesigner
{
if (!(this is TextDesignerItemViewModel))
{
if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Center)
if (Root.DiagramOption.LayoutOption.CellHorizontalAlignment == CellHorizontalAlignment.Center)
{
if (Root.GridCellSize.Width > this.ItemWidth)
if (Root.DiagramOption.LayoutOption.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width + (Root.GridCellSize.Width - this.ItemWidth) / 2;
this.Left = (int)(this.Left / Root.DiagramOption.LayoutOption.GridCellSize.Width) * Root.DiagramOption.LayoutOption.GridCellSize.Width + Root.DiagramOption.LayoutOption.GridMarginSize.Width + (Root.DiagramOption.LayoutOption.GridCellSize.Width - this.ItemWidth) / 2;
}
}
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Left)
else if (Root.DiagramOption.LayoutOption.CellHorizontalAlignment == CellHorizontalAlignment.Left)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width;
this.Left = (int)(this.Left / Root.DiagramOption.LayoutOption.GridCellSize.Width) * Root.DiagramOption.LayoutOption.GridCellSize.Width + Root.DiagramOption.LayoutOption.GridMarginSize.Width;
}
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Right)
else if (Root.DiagramOption.LayoutOption.CellHorizontalAlignment == CellHorizontalAlignment.Right)
{
if (Root.GridCellSize.Width > this.ItemWidth)
if (Root.DiagramOption.LayoutOption.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width + (Root.GridCellSize.Width - this.ItemWidth);
this.Left = (int)(this.Left / Root.DiagramOption.LayoutOption.GridCellSize.Width) * Root.DiagramOption.LayoutOption.GridCellSize.Width + Root.DiagramOption.LayoutOption.GridMarginSize.Width + (Root.DiagramOption.LayoutOption.GridCellSize.Width - this.ItemWidth);
}
}
if (Root.CellVerticalAlignment == CellVerticalAlignment.Center)
if (Root.DiagramOption.LayoutOption.CellVerticalAlignment == CellVerticalAlignment.Center)
{
if (Root.GridCellSize.Height > this.ItemHeight)
if (Root.DiagramOption.LayoutOption.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height + (Root.GridCellSize.Height - this.ItemHeight) / 2;
this.Top = (int)(this.Top / Root.DiagramOption.LayoutOption.GridCellSize.Height) * Root.DiagramOption.LayoutOption.GridCellSize.Height + Root.DiagramOption.LayoutOption.GridMarginSize.Height + (Root.DiagramOption.LayoutOption.GridCellSize.Height - this.ItemHeight) / 2;
}
}
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Top)
else if (Root.DiagramOption.LayoutOption.CellVerticalAlignment == CellVerticalAlignment.Top)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height;
this.Top = (int)(this.Top / Root.DiagramOption.LayoutOption.GridCellSize.Height) * Root.DiagramOption.LayoutOption.GridCellSize.Height + Root.DiagramOption.LayoutOption.GridMarginSize.Height;
}
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Bottom)
else if (Root.DiagramOption.LayoutOption.CellVerticalAlignment == CellVerticalAlignment.Bottom)
{
if (Root.GridCellSize.Height > this.ItemHeight)
if (Root.DiagramOption.LayoutOption.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height + (Root.GridCellSize.Height - this.ItemHeight);
this.Top = (int)(this.Top / Root.DiagramOption.LayoutOption.GridCellSize.Height) * Root.DiagramOption.LayoutOption.GridCellSize.Height + Root.DiagramOption.LayoutOption.GridMarginSize.Height + (Root.DiagramOption.LayoutOption.GridCellSize.Height - this.ItemHeight);
}
}
}