mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
DiagramOption LayoutOption 参数整理
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user