mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-30 05:03:23 +08:00
xx
This commit is contained in:
@@ -54,6 +54,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
break;
|
||||
}
|
||||
case NodeLevel.Level3:
|
||||
case NodeLevel.Level4:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
var lastchildsize = childrensizes.LastOrDefault();
|
||||
sizewithSpacing = new SizeBase(sizewithSpacing.Width + childrensizes.Sum(p => p.Height) - lastchildsize.Height / 2 + lastchildsize.Width, sizewithSpacing.Height + childrensizes.Sum(p => p.Height));
|
||||
}
|
||||
else if (mindNode.NodeLevel == NodeLevel.Level3)
|
||||
else if (mindNode.NodeLevel == NodeLevel.Level3 || mindNode.NodeLevel == NodeLevel.Level4)
|
||||
{
|
||||
var childrensizes = mindNode.Children.Select(p => MeasureOverride(p, mindNode.IsExpanded && isExpanded)).ToArray();
|
||||
sizewithSpacing = new SizeBase(Math.Max(sizewithSpacing.Width, sizewithSpacing.Width * 0.5 + childrensizes.Max(p => p.Width)), sizewithSpacing.Height + childrensizes.Sum(p => p.Height));
|
||||
@@ -215,7 +215,54 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
}
|
||||
else if (mindNode.NodeLevel == NodeLevel.Level2)
|
||||
{
|
||||
if (mindNode.ConnectorOrientation == ConnectorOrientation.BottomLeft)
|
||||
{
|
||||
double left = mindNode.Left - mindNode.Spacing.Width + mindNode.DesiredSize.Height;
|
||||
double top = mindNode.Top - mindNode.Spacing.Height;
|
||||
if (mindNode.Children?.Count > 0)
|
||||
{
|
||||
|
||||
foreach (var child in mindNode.Children)
|
||||
{
|
||||
child.Left = left + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height + child.Offset.X;
|
||||
child.Top = top - child.DesiredSize.Height + child.ItemHeight / 2 + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
top -= child.DesiredSize.Height;
|
||||
left += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
|
||||
var connect = mindNode.Root?.Items.OfType<ConnectionViewModel>().FirstOrDefault(p => p.SourceConnectorInfo?.DataItem == mindNode && p.SinkConnectorInfoFully?.DataItem == child);
|
||||
connect?.SetSourcePort(mindNode.BottomLeftConnector);
|
||||
connect?.SetSinkPort(child.LeftConnector);
|
||||
connect?.SetVisible(child.Visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double left = mindNode.Left - mindNode.Spacing.Width + mindNode.DesiredSize.Height;
|
||||
double top = mindNode.Top - mindNode.Spacing.Height;
|
||||
if (mindNode.Children?.Count > 0)
|
||||
{
|
||||
|
||||
foreach (var child in mindNode.Children)
|
||||
{
|
||||
child.Left = left + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height + child.Offset.X;
|
||||
child.Top = top - child.DesiredSize.Height + child.ItemHeight / 2 + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
top -= child.DesiredSize.Height;
|
||||
left += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
|
||||
var connect = mindNode.Root?.Items.OfType<ConnectionViewModel>().FirstOrDefault(p => p.SourceConnectorInfo?.DataItem == mindNode && p.SinkConnectorInfoFully?.DataItem == child);
|
||||
connect?.SetSourcePort(mindNode.BottomLeftConnector);
|
||||
connect?.SetSinkPort(child.LeftConnector);
|
||||
connect?.SetVisible(child.Visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
break;
|
||||
}
|
||||
case NodeLevel.Level3:
|
||||
case NodeLevel.Level4:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
node = new MindNode(Root, NodeLevel + 1, this.MindType) { Text = "分支主题" };
|
||||
node = new MindNode(Root, (NodeLevel)Math.Min((int)NodeLevel + 1, (int)NodeLevel.Level4), this.MindType) { Text = "分支主题" };
|
||||
}
|
||||
AddChild(node);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user