mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-02 14:01:29 +08:00
fishbone
This commit is contained in:
@@ -68,6 +68,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
|
|
||||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||||
mindNode.AddConnector(port1);
|
mindNode.AddConnector(port1);
|
||||||
|
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||||
|
mindNode.AddConnector(port2);
|
||||||
|
|
||||||
mindNode.IsInnerConnector = true;
|
mindNode.IsInnerConnector = true;
|
||||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||||
@@ -85,6 +87,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
|
|
||||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||||
mindNode.AddConnector(port1);
|
mindNode.AddConnector(port1);
|
||||||
|
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||||
|
mindNode.AddConnector(port2);
|
||||||
|
|
||||||
mindNode.IsInnerConnector = true;
|
mindNode.IsInnerConnector = true;
|
||||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||||
@@ -217,17 +221,17 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
if (mindNode.ConnectorOrientation == ConnectorOrientation.BottomLeft)
|
if (mindNode.ConnectorOrientation == ConnectorOrientation.BottomLeft)
|
||||||
{
|
{
|
||||||
double left = mindNode.Left + mindNode.ItemHeight + mindNode.Spacing.Height;
|
double x0 = mindNode.Left;
|
||||||
double top = mindNode.Top - mindNode.Spacing.Height;
|
double y0 = mindNode.Top + mindNode.ItemHeight;
|
||||||
|
double h = mindNode.ItemHeight + mindNode.Spacing.Height;
|
||||||
if (mindNode.Children?.Count > 0)
|
if (mindNode.Children?.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var child in mindNode.Children)
|
foreach (var child in mindNode.Children)
|
||||||
{
|
{
|
||||||
child.Left = left + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height + child.Offset.X;
|
child.Left = x0 + (h + 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.Top = y0 - (h + child.DesiredSize.Height - child.Spacing.Height) + child.Offset.Y;
|
||||||
child.DesiredPosition = child.Position;
|
child.DesiredPosition = child.Position;
|
||||||
top -= child.DesiredSize.Height;
|
h += child.DesiredSize.Height;
|
||||||
left += child.DesiredSize.Height;
|
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
|
|
||||||
@@ -240,17 +244,17 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double left = mindNode.Left + mindNode.ItemHeight + mindNode.Spacing.Height;
|
double x0 = mindNode.Left;
|
||||||
double top = mindNode.Top + mindNode.ItemHeight + mindNode.Spacing.Height;
|
double y0 = mindNode.Top;
|
||||||
|
double h = mindNode.ItemHeight + mindNode.Spacing.Height;
|
||||||
if (mindNode.Children?.Count > 0)
|
if (mindNode.Children?.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var child in mindNode.Children)
|
foreach (var child in mindNode.Children)
|
||||||
{
|
{
|
||||||
child.Left = left + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height + child.Offset.X;
|
child.Left = x0 + (h + 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.Top = y0 + (h + child.DesiredSize.Height - child.ItemHeight - child.Spacing.Height) + child.Offset.Y;
|
||||||
child.DesiredPosition = child.Position;
|
child.DesiredPosition = child.Position;
|
||||||
top += child.DesiredSize.Height;
|
h += child.DesiredSize.Height;
|
||||||
left += child.DesiredSize.Height;
|
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
|
|
||||||
@@ -262,6 +266,28 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mindNode.NodeLevel == NodeLevel.Level3 || mindNode.NodeLevel == NodeLevel.Level4)
|
||||||
|
{
|
||||||
|
double left = mindNode.MiddlePosition.X;
|
||||||
|
double top = mindNode.MiddlePosition.Y + mindNode.ItemHeight / 2 + mindNode.Spacing.Height;
|
||||||
|
if (mindNode.Children?.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var child in mindNode.Children)
|
||||||
|
{
|
||||||
|
child.Left = left + child.Offset.X;
|
||||||
|
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||||
|
child.DesiredPosition = child.Position;
|
||||||
|
top += 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.BottomConnector);
|
||||||
|
connect?.SetSinkPort(child.LeftConnector);
|
||||||
|
connect?.SetVisible(child.Visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user