mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-06 01:06:37 +08:00
mind继续
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
xmlns:drop="urn:gong-wpf-dragdrop"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:converter="clr-namespace:AIStudio.Wpf.DiagramDesigner.Additionals.Converters;assembly=AIStudio.Wpf.DiagramDesigner.Additionals"
|
||||
xmlns:mimd="clr-namespace:AIStudio.Wpf.Mind;assembly=AIStudio.Wpf.Mind"
|
||||
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.DiagramApp.ViewModels"
|
||||
Style="{StaticResource RibbonWindowStyle}"
|
||||
Icon="pack://application:,,,/AIStudio.Wpf.DiagramApp;component/Icons/App.ico"
|
||||
@@ -844,7 +845,7 @@
|
||||
<iconPacks:PackIconMaterial Kind="VectorPolylineEdit" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Fluent:SplitButton.Style>
|
||||
@@ -1142,7 +1143,7 @@
|
||||
Format="0 pt" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="箭头样式" Margin="5"/>
|
||||
<TextBlock Text="箭头样式" Margin="5"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Fluent:ComboBox Size="Small" Width="140" Margin="5" IsEditable="False" helper:EnumHelper.Enum="{x:Type dd:ArrowPathStyle}" SelectedItem="{Binding ShapeViewModel.SourceMarker.PathStyle}">
|
||||
<Fluent:ComboBox.ItemTemplate>
|
||||
@@ -1195,7 +1196,7 @@
|
||||
</Fluent:ComboBox.ItemTemplate>
|
||||
</Fluent:ComboBox>
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -1239,7 +1240,7 @@
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</Fluent:ComboBox.ItemTemplate>
|
||||
</Fluent:ComboBox>
|
||||
</Fluent:ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Text="线条动画" Margin="5"/>
|
||||
@@ -1573,7 +1574,7 @@
|
||||
<TextBlock Text="无" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</Fluent:ToggleButton.LargeIcon>
|
||||
</Fluent:ToggleButton>
|
||||
</Fluent:ToggleButton>
|
||||
</UniformGrid>
|
||||
<Fluent:SplitButton.ToolTip>
|
||||
<Fluent:ScreenTip Title="ShowGrid"
|
||||
@@ -1709,7 +1710,7 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Fluent:SplitButton.Style>
|
||||
</Fluent:SplitButton.Style>
|
||||
<Fluent:SplitButton.ToolTip>
|
||||
<Fluent:ScreenTip Title="ShowGrid"
|
||||
Text="竖向对齐到网格方式"
|
||||
@@ -1751,6 +1752,34 @@
|
||||
</Fluent:SplitButton>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="脑图">
|
||||
<Fluent:RibbonGroupBox Header="外观"
|
||||
IsLauncherVisible="True">
|
||||
|
||||
<Fluent:SplitButton Header="类型" Width="50" VerticalAlignment="Top">
|
||||
<Fluent:SplitButton.LargeIcon>
|
||||
<Grid>
|
||||
<iconPacks:PackIconMaterial Kind="FileOutline" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<TextBlock Text="S" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="9"/>
|
||||
</Grid>
|
||||
</Fluent:SplitButton.LargeIcon>
|
||||
<ListBox BorderThickness="0" helper:EnumHelper.Enum="{x:Type mimd:MindType}" SelectedItem="{Binding SelectedItem.MindType}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding .,Converter={StaticResource EnumDescriptionConverter}}" Margin="5"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Fluent:SplitButton.ToolTip>
|
||||
<Fluent:ScreenTip Title="PageSize"
|
||||
Text="页面大小"
|
||||
Width="190" />
|
||||
</Fluent:SplitButton.ToolTip>
|
||||
</Fluent:SplitButton>
|
||||
|
||||
</Fluent:RibbonGroupBox>
|
||||
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="帮助">
|
||||
<Fluent:RibbonGroupBox>
|
||||
<Fluent:SplitButton Header="指引" Width="50" VerticalAlignment="Top">
|
||||
|
||||
@@ -32,16 +32,19 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
foreach(var item in e.NewItems)
|
||||
foreach (var item in e.NewItems)
|
||||
{
|
||||
FullyCreatedConnectorInfo vm = item as FullyCreatedConnectorInfo;
|
||||
var connector = ItemContainerGenerator.ContainerFromItem(item) as ContentPresenter;
|
||||
|
||||
Canvas.SetLeft(connector, vm.DataItem.ItemWidth * vm.XRatio - vm.ConnectorWidth / 2);
|
||||
Canvas.SetTop(connector, vm.DataItem.ItemHeight * vm.YRatio - vm.ConnectorHeight / 2);
|
||||
if (connector != null)
|
||||
{
|
||||
Canvas.SetLeft(connector, vm.DataItem.ItemWidth * vm.XRatio - vm.ConnectorWidth / 2);
|
||||
Canvas.SetTop(connector, vm.DataItem.ItemHeight * vm.YRatio - vm.ConnectorHeight / 2);
|
||||
}
|
||||
}
|
||||
//SetConnectorLocation();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ConnectorContainer_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
|
||||
@@ -464,7 +464,16 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Labels.FirstOrDefault()?.AddToSelection(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(RouterMode):
|
||||
var routetype = GlobalType.AllTypes.Where(p => typeof(IRouter).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == RouterMode);
|
||||
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
|
||||
UpdatePathGeneratorResult();
|
||||
break;
|
||||
case nameof(PathMode):
|
||||
var pathGeneratortype = GlobalType.AllTypes.Where(p => typeof(IPathGenerator).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == PathMode);
|
||||
PathGenerator = pathGeneratortype != null ? (System.Activator.CreateInstance(pathGeneratortype) as IPathGenerator) : new ConnectingLineSmooth();
|
||||
UpdatePathGeneratorResult();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (sender is ShapeViewModel)
|
||||
|
||||
@@ -87,8 +87,15 @@
|
||||
CornerRadius="{Binding CornerRadius,Converter={StaticResource DoubleToCornerRadius}}">
|
||||
</Border>
|
||||
</Grid>
|
||||
<ToggleButton IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
||||
<ToggleButton x:Name="toggle" IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
|
||||
<DataTrigger Binding="{Binding IsRightLayout}" Value="false">
|
||||
<Setter TargetName="toggle" Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter TargetName="toggle" Property="Margin" Value="0,0,-15,0"/>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="MindLevel3NodeStyle" TargetType="{x:Type ContentControl}">
|
||||
@@ -115,8 +122,14 @@
|
||||
|
||||
</Border>
|
||||
</Grid>
|
||||
<ToggleButton IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
||||
<ToggleButton x:Name="toggle" IsChecked="{Binding IsExpanded}" Style="{StaticResource ExpandCollapseToggleStyle}" HorizontalAlignment="Left" Margin="-15,0,0,0" Visibility="{Binding Children.Count,Converter={StaticResource IntToVisibilityConverter}}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsRightLayout}" Value="false">
|
||||
<Setter TargetName="toggle" Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter TargetName="toggle" Property="Margin" Value="0,0,-15,0"/>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="MindNodeStyle" TargetType="{x:Type ContentControl}">
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
|
||||
private void LevelInit(bool init = false)
|
||||
{
|
||||
{
|
||||
switch (NodeLevel)
|
||||
{
|
||||
case NodeLevel.Level1:
|
||||
@@ -60,8 +60,23 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
ItemWidth = 110;
|
||||
ItemHeight = 40;
|
||||
this.ClearConnectors();
|
||||
var port = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
this.AddConnector(port);
|
||||
switch (MindType)
|
||||
{
|
||||
case MindType.Mind:
|
||||
case MindType.Logical:
|
||||
{
|
||||
var port = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
this.AddConnector(port);
|
||||
break;
|
||||
}
|
||||
case MindType.Directory:
|
||||
{
|
||||
var port = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
this.AddConnector(port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IsInnerConnector = true;
|
||||
|
||||
ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
@@ -79,10 +94,26 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
ItemWidth = 80;
|
||||
ItemHeight = 25;
|
||||
this.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
this.AddConnector(port2);
|
||||
switch (MindType)
|
||||
{
|
||||
case MindType.Mind:
|
||||
case MindType.Logical:
|
||||
{
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
this.AddConnector(port2);
|
||||
break;
|
||||
}
|
||||
case MindType.Directory:
|
||||
{
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
this.AddConnector(port2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
IsInnerConnector = true;
|
||||
|
||||
ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
@@ -95,12 +126,29 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
ItemWidth = 80;
|
||||
ItemHeight = 25;
|
||||
this.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
this.AddConnector(port2);
|
||||
IsInnerConnector = true;
|
||||
|
||||
switch (MindType)
|
||||
{
|
||||
case MindType.Mind:
|
||||
case MindType.Logical:
|
||||
{
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
this.AddConnector(port2);
|
||||
break;
|
||||
}
|
||||
case MindType.Directory:
|
||||
{
|
||||
var port1 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
this.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(Root, this, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
this.AddConnector(port2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IsInnerConnector = true;
|
||||
ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
@@ -155,17 +203,26 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
SetProperty(ref _isExpanded, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SizeBase Spacing
|
||||
{
|
||||
get; set;
|
||||
} = new SizeBase(15, 15);
|
||||
|
||||
public List<MindNode> Children
|
||||
|
||||
private ObservableCollection<MindNode> _children = new ObservableCollection<MindNode>();
|
||||
public ObservableCollection<MindNode> Children
|
||||
{
|
||||
get; set;
|
||||
} = new List<MindNode>();
|
||||
get
|
||||
{
|
||||
return _children;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _children, value);
|
||||
}
|
||||
}
|
||||
|
||||
public SizeBase SizeWithSpacing
|
||||
{
|
||||
@@ -190,7 +247,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
get; set;
|
||||
}
|
||||
|
||||
private MindType _mindType;
|
||||
private MindType _mindType = MindType.Directory;
|
||||
public MindType MindType
|
||||
{
|
||||
get
|
||||
@@ -203,9 +260,20 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private bool _layoutUpdating;
|
||||
|
||||
private bool _isRightLayout = true;
|
||||
public bool IsRightLayout
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isRightLayout;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _isRightLayout, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _layoutUpdating;
|
||||
#endregion
|
||||
|
||||
#region 附加信息属性
|
||||
@@ -274,8 +342,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _tags;
|
||||
public List<string> Tags
|
||||
private ObservableCollection<string> _tags;
|
||||
public ObservableCollection<string> Tags
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -481,7 +549,18 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
item.Parent = this;
|
||||
Root?.DirectAddItemCommand.Execute(item);
|
||||
|
||||
ConnectionViewModel connector = new ConnectionViewModel(Root, this.Connectors.FirstOrDefault(), item.Connectors.FirstOrDefault());
|
||||
DrawMode drawMode = DrawMode.ConnectingLineSmooth;
|
||||
RouterMode routerMode = AIStudio.Wpf.DiagramDesigner.RouterMode.RouterNormal;
|
||||
switch (MindType)
|
||||
{
|
||||
case MindType.Directory:
|
||||
drawMode = DrawMode.ConnectingLineStraight;
|
||||
routerMode = AIStudio.Wpf.DiagramDesigner.RouterMode.RouterOrthogonal;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
ConnectionViewModel connector = new ConnectionViewModel(Root, this.Connectors.FirstOrDefault(), item.Connectors.FirstOrDefault(), drawMode, routerMode);
|
||||
connector.ColorViewModel.LineColor = this.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
@@ -526,7 +605,15 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
case nameof(ItemWidth):
|
||||
case nameof(ItemHeight):
|
||||
case nameof(MindType):
|
||||
GetLevel1Node()?.LayoutUpdated();
|
||||
if (NodeLevel == NodeLevel.Level1)
|
||||
{
|
||||
LevelInit();
|
||||
LayoutUpdated();
|
||||
}
|
||||
else
|
||||
{
|
||||
GetLevel1Node().MindType = MindType;
|
||||
}
|
||||
break;
|
||||
case nameof(NodeLevel):
|
||||
LevelInit();
|
||||
@@ -620,7 +707,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
protected SizeBase MeasureOverride(bool isExpanded = true)
|
||||
{
|
||||
switch (MindType)
|
||||
switch (GetLevel1Node()?.MindType)
|
||||
{
|
||||
case MindType.Mind:
|
||||
{
|
||||
@@ -630,11 +717,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
if (NodeLevel == NodeLevel.Level1)
|
||||
{
|
||||
var rights = Children.Where((p, index) => index % 2 == 0).ToList();
|
||||
rights.ForEach(p => p._isRightLayout = true);
|
||||
rights.ForEach(p => p.IsRightLayout = true);
|
||||
var rightsizes = rights.Select(p => p.MeasureOverride(IsExpanded && isExpanded)).ToArray();
|
||||
|
||||
var lefts = Children.Where((p, index) => index % 2 == 1).ToList();
|
||||
lefts.ForEach(p => p._isRightLayout = false);
|
||||
lefts.ForEach(p => p.IsRightLayout = false);
|
||||
var leftsizes = lefts.Select(p => p.MeasureOverride(IsExpanded && isExpanded)).ToArray();
|
||||
sizewithSpacing = new SizeBase(sizewithSpacing.Width + rightsizes.Max(p => p.Width) + +leftsizes.Max(p => p.Width), Math.Max(sizewithSpacing.Height, Math.Max(rightsizes.Sum(p => p.Height), leftsizes.Sum(p => p.Height))));
|
||||
}
|
||||
@@ -664,6 +751,28 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
connectors?.ForEach(p => p.Visible = Visible);
|
||||
break;
|
||||
}
|
||||
case MindType.Directory:
|
||||
{
|
||||
var sizewithSpacing = SizeWithSpacing;
|
||||
if (Children?.Count > 0)
|
||||
{
|
||||
if (NodeLevel == NodeLevel.Level1)
|
||||
{
|
||||
var childrensizes = Children.Select(p => p.MeasureOverride(IsExpanded && isExpanded)).ToArray();
|
||||
sizewithSpacing = new SizeBase(Math.Max(sizewithSpacing.Width, childrensizes.Sum(p => p.Width)), sizewithSpacing.Height + childrensizes.Max(p => p.Height));
|
||||
}
|
||||
else
|
||||
{
|
||||
var childrensizes = Children.Select(p => p.MeasureOverride(IsExpanded && isExpanded)).ToArray();
|
||||
sizewithSpacing = new SizeBase(sizewithSpacing.Width * 0.5 + childrensizes.Max(p => p.Width), sizewithSpacing.Height + childrensizes.Sum(p => p.Height));
|
||||
}
|
||||
}
|
||||
DesiredSize = isExpanded ? sizewithSpacing : new SizeBase(0, 0);
|
||||
Visible = isExpanded;
|
||||
var connectors = Root?.Items.OfType<ConnectionViewModel>().Where(p => p.SinkConnectorInfoFully?.DataItem == this).ToList();
|
||||
connectors?.ForEach(p => p.Visible = Visible);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
var sizewithSpacing = SizeWithSpacing;
|
||||
@@ -684,7 +793,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
protected void ArrangeOverride()
|
||||
{
|
||||
switch (MindType)
|
||||
switch (GetLevel1Node()?.MindType)
|
||||
{
|
||||
case MindType.Mind:
|
||||
{
|
||||
@@ -692,7 +801,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
if (Children?.Count > 0)
|
||||
{
|
||||
var rights = Children.Where(p => p._isRightLayout == true).ToList();
|
||||
var rights = Children.Where(p => p.IsRightLayout == true).ToList();
|
||||
double left = MiddlePosition.X + ItemWidth / 2 + Spacing.Width;
|
||||
double lefttop = MiddlePosition.Y - Math.Min(DesiredSize.Height, rights.Sum(p => p.DesiredSize.Height)) / 2;
|
||||
foreach (var child in rights)
|
||||
@@ -705,12 +814,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
child.ArrangeOverride();
|
||||
}
|
||||
|
||||
var lefts = Children.Where(p => p._isRightLayout == false).ToList();
|
||||
var lefts = Children.Where(p => p.IsRightLayout == false).ToList();
|
||||
double right = MiddlePosition.X - ItemWidth / 2 - Spacing.Width;
|
||||
double righttop = MiddlePosition.Y - Math.Min(DesiredSize.Height, lefts.Sum(p => p.DesiredSize.Height)) / 2;
|
||||
double righttop = MiddlePosition.Y - Math.Min(DesiredSize.Height, lefts.Sum(p => p.DesiredSize.Height)) / 2;
|
||||
foreach (var child in lefts)
|
||||
{
|
||||
child.Left = right - child.Spacing.Width - child.ItemWidth + child.Offset.X ;
|
||||
child.Left = right - child.Spacing.Width - child.ItemWidth + child.Offset.X;
|
||||
child.Top = righttop + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
righttop += child.DesiredSize.Height;
|
||||
@@ -721,7 +830,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetLevel2Node()._isRightLayout)
|
||||
if (GetLevel2Node().IsRightLayout)
|
||||
{
|
||||
double left = MiddlePosition.X + ItemWidth / 2 + Spacing.Width;
|
||||
double top = MiddlePosition.Y - Math.Min(DesiredSize.Height, Children.Sum(p => p.DesiredSize.Height)) / 2;
|
||||
@@ -776,6 +885,44 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MindType.Directory:
|
||||
{
|
||||
if (NodeLevel == NodeLevel.Level1)
|
||||
{
|
||||
double left = MiddlePosition.X - Math.Max(DesiredSize.Width, Children.Sum(p => p.DesiredSize.Width)) / 2;
|
||||
double top = MiddlePosition.Y + ItemHeight / 2 + Spacing.Height;
|
||||
if (Children?.Count > 0)
|
||||
{
|
||||
foreach (var child in Children)
|
||||
{
|
||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
left += child.DesiredSize.Width;
|
||||
|
||||
child.ArrangeOverride();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = MiddlePosition.X;
|
||||
double top = MiddlePosition.Y + ItemHeight / 2 + Spacing.Height;
|
||||
if (Children?.Count > 0)
|
||||
{
|
||||
foreach (var child in Children)
|
||||
{
|
||||
child.Left = left + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
child.ArrangeOverride();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user