mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-13 12:46:36 +08:00
mind的拷贝完成
This commit is contained in:
@@ -88,14 +88,10 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
||||
}
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
connector.OrthogonalShapeMargin = 2;
|
||||
connector.OrthogonalGlobalBoundsMargin = 5;
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.ShapeViewModel.SinkMarker.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||
|
||||
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||
return connector;
|
||||
}
|
||||
|
||||
@@ -147,7 +143,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.DesiredSize.Width / 2 - child.ItemWidth / 2 + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left + child.DesiredSize.Width / 2 - child.ItemWidth / 2, top + child.Spacing.Height);
|
||||
left += child.DesiredSize.Width;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -158,6 +154,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.SetVisible(child.Visible);
|
||||
}
|
||||
}
|
||||
|
||||
mindNode.DesiredPosition = mindNode.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,7 +167,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left, top + child.Spacing.Height);
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
|
||||
@@ -115,12 +115,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, drawMode.ToString(), routerMode.ToString());
|
||||
}
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
connector.OrthogonalShapeMargin = 2;
|
||||
connector.OrthogonalGlobalBoundsMargin = 5;
|
||||
connector.ShapeViewModel.SinkMarker.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||
|
||||
return connector;
|
||||
}
|
||||
@@ -186,7 +183,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = topleft + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = toptop - child.ItemHeight - child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(topleft + child.Spacing.Width, toptop - child.ItemHeight - child.Spacing.Height);
|
||||
topleft += child.DesiredSize.Width;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -209,7 +206,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = bottomleft + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = bottomtop + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(bottomleft + child.Spacing.Width, bottomtop + child.Spacing.Height);
|
||||
bottomleft += child.DesiredSize.Width;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -220,6 +217,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.SetVisible(child.Visible);
|
||||
}
|
||||
}
|
||||
|
||||
mindNode.DesiredPosition = mindNode.Position;
|
||||
}
|
||||
else if (mindNode.NodeLevel == 1)
|
||||
{
|
||||
@@ -234,7 +233,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = x0 + (h + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height) + child.Offset.X;
|
||||
child.Top = y0 - (h + child.DesiredSize.Height - child.Spacing.Height) + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(x0 + (h + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height), y0 - (h + child.DesiredSize.Height - child.Spacing.Height));
|
||||
h += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -257,7 +256,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = x0 + (h + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height) + child.Offset.X;
|
||||
child.Top = y0 + (h + child.DesiredSize.Height - child.ItemHeight - child.Spacing.Height) + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(x0 + (h + child.DesiredSize.Height - child.ItemHeight / 2 - child.Spacing.Height), y0 + (h + child.DesiredSize.Height - child.ItemHeight - child.Spacing.Height));
|
||||
h += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -282,7 +281,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left, top + child.Spacing.Height);
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -304,7 +303,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.Offset.X;
|
||||
child.Top = bottom - child.Spacing.Height - child.ItemHeight + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left, bottom - child.Spacing.Height - child.ItemHeight);
|
||||
bottom -= child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
|
||||
@@ -86,13 +86,10 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineSmooth.ToString(), RouterMode.RouterNormal.ToString());
|
||||
}
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
connector.OrthogonalShapeMargin = 2;
|
||||
connector.OrthogonalGlobalBoundsMargin = 5;
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.ShapeViewModel.SinkMarker.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||
|
||||
return connector;
|
||||
}
|
||||
@@ -134,7 +131,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = top + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left + child.Spacing.Width, top + child.DesiredSize.Height / 2 - child.ItemHeight / 2);
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -144,6 +141,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.SetSinkPort(child.LeftConnector);
|
||||
connector?.SetVisible(child.Visible);
|
||||
}
|
||||
|
||||
mindNode.DesiredPosition = mindNode.Position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
|
||||
mindNode.ClearConnectors();
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
mindNode.AddConnector(port);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
@@ -89,12 +89,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
}
|
||||
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
connector.OrthogonalShapeMargin = 2;
|
||||
connector.OrthogonalGlobalBoundsMargin = 5;
|
||||
connector.ShapeViewModel.SinkMarker.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||
|
||||
return connector;
|
||||
}
|
||||
@@ -114,7 +111,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
|
||||
public SizeBase MeasureOverride(MindNode mindNode, bool isExpanded = true)
|
||||
{
|
||||
var sizewithSpacing = mindNode.SizeWithSpacing;
|
||||
var sizewithSpacing = mindNode.SizeWithSpacing;
|
||||
if (mindNode.Children?.Count > 0)
|
||||
{
|
||||
if (mindNode.NodeLevel == 0)
|
||||
@@ -132,7 +129,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
var childrensizes = mindNode.Children.Select(p => MeasureOverride(p, mindNode.IsExpanded && isExpanded)).ToArray();
|
||||
sizewithSpacing = new SizeBase(sizewithSpacing.Width + childrensizes.MaxOrDefault(p => p.Width), Math.Max(sizewithSpacing.Height, childrensizes.SumOrDefault(p => p.Height)));
|
||||
}
|
||||
}
|
||||
}
|
||||
mindNode.DesiredSize = isExpanded ? sizewithSpacing : new SizeBase(0, 0);
|
||||
mindNode.Visible = isExpanded;
|
||||
|
||||
@@ -145,14 +142,14 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
if (mindNode.Children?.Count > 0)
|
||||
{
|
||||
var rights = mindNode.Children.Where(p => p.ConnectorOrientation == ConnectorOrientation.Left).ToList();
|
||||
var rights = mindNode.Children.Where(p => p.ConnectorOrientation == ConnectorOrientation.Left).ToList();
|
||||
double left = mindNode.MiddlePosition.X + mindNode.ItemWidth / 2 + mindNode.Spacing.Width;
|
||||
double lefttop = mindNode.MiddlePosition.Y - Math.Min(mindNode.DesiredSize.Height, rights.SumOrDefault(p => p.DesiredSize.Height)) / 2;
|
||||
foreach (var child in rights)
|
||||
{
|
||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = lefttop + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left + child.Spacing.Width, lefttop + child.DesiredSize.Height / 2 - child.ItemHeight / 2);
|
||||
lefttop += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -170,7 +167,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
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;
|
||||
child.DesiredPosition = new PointBase(right - child.Spacing.Width - child.ItemWidth, righttop + child.DesiredSize.Height / 2 - child.ItemHeight / 2);
|
||||
righttop += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -181,6 +178,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.SetVisible(child.Visible);
|
||||
}
|
||||
}
|
||||
|
||||
mindNode.DesiredPosition = mindNode.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,7 +193,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||
child.Top = top + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left + child.Spacing.Width, top + child.DesiredSize.Height / 2 - child.ItemHeight / 2);
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -216,7 +215,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = right - child.Spacing.Width - child.ItemWidth + child.Offset.X;
|
||||
child.Top = top + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(right - child.Spacing.Width - child.ItemWidth, top + child.DesiredSize.Height / 2 - child.ItemHeight / 2);
|
||||
top += child.DesiredSize.Height;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -230,6 +229,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -496,6 +496,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
Name = "冷光黄",
|
||||
Key = "CoolLightYellow",
|
||||
Dark = true,
|
||||
MindThemeLevel1 = new MindTheme()
|
||||
{
|
||||
ItemWidth = 110,
|
||||
@@ -534,6 +535,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
Name = "紧凑黄",
|
||||
Key = "CoolLightYellowMini",
|
||||
Dark = true,
|
||||
MindThemeLevel1 = new MindTheme()
|
||||
{
|
||||
ItemWidth = 110,
|
||||
@@ -650,6 +652,10 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public bool Dark
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public MindTheme MindThemeLevel1
|
||||
{
|
||||
get; set;
|
||||
|
||||
@@ -88,13 +88,10 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
||||
}
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.SmoothMargin = 20;
|
||||
connector.SmoothAutoSlope = 0.2;
|
||||
connector.OrthogonalShapeMargin = 2;
|
||||
connector.OrthogonalGlobalBoundsMargin = 5;
|
||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
||||
connector.ShapeViewModel.SinkMarker.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||
connector.ShapeViewModel.SinkMarker.SizeStyle = sink.ShapeViewModel.SinkMarker.SizeStyle;
|
||||
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||
|
||||
return connector;
|
||||
}
|
||||
@@ -136,7 +133,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
child.Left = left + child.DesiredSize.Width / 2 - child.ItemWidth / 2 + child.Offset.X;
|
||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
||||
child.DesiredPosition = child.Position;
|
||||
child.DesiredPosition = new PointBase(left + child.DesiredSize.Width / 2 - child.ItemWidth / 2, top + child.Spacing.Height);
|
||||
left += child.DesiredSize.Width;
|
||||
|
||||
ArrangeOverride(child);
|
||||
@@ -146,6 +143,12 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
connector?.SetSinkPort(child.TopConnector);
|
||||
connector?.SetVisible(child.Visible);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mindNode.NodeLevel == 0)
|
||||
{
|
||||
mindNode.DesiredPosition = mindNode.Position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user