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

@@ -33,13 +33,13 @@ namespace AIStudio.Wpf.Flowchart.Controls
public FlowchartEditor()
{
_diagramViewModel = new DiagramViewModel();
_diagramViewModel.ShowGrid = true;
_diagramViewModel.GridCellSize = new SizeBase(125 / ScreenHelper.ScreenScale, 125 / ScreenHelper.ScreenScale);
_diagramViewModel.GridMarginSize = new Size(0, 0);
_diagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
_diagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
_diagramViewModel.PageSizeType = PageSizeType.Custom;
_diagramViewModel.PageSize = new SizeBase(double.NaN, double.NaN);
_diagramViewModel.DiagramOption.LayoutOption.ShowGrid = true;
_diagramViewModel.DiagramOption.LayoutOption.GridCellSize = new SizeBase(125 / ScreenHelper.ScreenScale, 125 / ScreenHelper.ScreenScale);
_diagramViewModel.DiagramOption.LayoutOption.GridMarginSize = new Size(0, 0);
_diagramViewModel.DiagramOption.LayoutOption.CellHorizontalAlignment = CellHorizontalAlignment.Center;
_diagramViewModel.DiagramOption.LayoutOption.CellVerticalAlignment = CellVerticalAlignment.Center;
_diagramViewModel.DiagramOption.LayoutOption.PageSizeType = PageSizeType.Custom;
_diagramViewModel.DiagramOption.LayoutOption.PageSize = new SizeBase(double.NaN, double.NaN);
_diagramViewModel.ColorViewModel = new ColorViewModel() { LineWidth = 2 };
_diagramViewModel.DrawModeViewModel = new DrawModeViewModel() { LineDrawMode = DrawMode.ConnectingLineSmooth };

View File

@@ -40,10 +40,10 @@ namespace AIStudio.Wpf.Mind.Controls
public MindEditor()
{
_diagramViewModel = new MindDiagramViewModel();
_diagramViewModel.GridMarginSize = new Size(0, 0);
_diagramViewModel.PageSizeType = PageSizeType.Custom;
_diagramViewModel.PageSize = new SizeBase(1000d, 1000d);
_diagramViewModel.ShowGrid= false;
_diagramViewModel.DiagramOption.LayoutOption.GridMarginSize = new Size(0, 0);
_diagramViewModel.DiagramOption.LayoutOption.PageSizeType = PageSizeType.Custom;
_diagramViewModel.DiagramOption.LayoutOption.PageSize = new SizeBase(1000d, 1000d);
_diagramViewModel.DiagramOption.LayoutOption.ShowGrid = false;
_diagramViewModel.DefaultZoomBox = true;
_diagramViewModel.PropertyChanged += DiagramViewModel_PropertyChanged;

View File

@@ -1132,11 +1132,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
var mindThemeModel = MindThemeHelper.GetTheme(newMindTheme);
if (mindThemeModel?.Dark == true)
{
PageBackground = Colors.Black;
DiagramOption.LayoutOption.PageBackground = Colors.Black;
}
else
{
PageBackground = Colors.White;
DiagramOption.LayoutOption.PageBackground = Colors.White;
}
roots.ForEach(p => p.MindTheme = newMindTheme);
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
@@ -1146,11 +1146,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
var mindThemeModel = MindThemeHelper.GetTheme(oldMindTheme);
if (mindThemeModel?.Dark == true)
{
PageBackground = Colors.Black;
DiagramOption.LayoutOption.PageBackground = Colors.Black;
}
else
{
PageBackground = Colors.White;
DiagramOption.LayoutOption.PageBackground = Colors.White;
}
roots.ForEach(p => p.MindTheme = oldMindTheme);
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
@@ -1275,9 +1275,9 @@ namespace AIStudio.Wpf.Mind.ViewModels
{
if (left == null)
left = (PageSize.Width - rootitem.ItemWidth) / 2;
left = (DiagramOption.LayoutOption.PageSize.Width - rootitem.ItemWidth) / 2;
if (top == null)
top = (PageSize.Height - rootitem.ItemHeight) / 2;
top = (DiagramOption.LayoutOption.PageSize.Height - rootitem.ItemHeight) / 2;
var offset = rootitem.Offset;
rootitem.Left = left.Value;
rootitem.Top = top.Value;