mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-29 12:43:24 +08:00
mind
This commit is contained in:
@@ -13,65 +13,71 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public class DirectoryLayout : IMindLayout
|
||||
{
|
||||
public void Appearance(MindNode mindNode)
|
||||
public void Appearance(MindNode mindNode, bool initAppearance)
|
||||
{
|
||||
switch (mindNode.NodeLevel)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port);
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.None;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
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.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
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.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public class FishBoneLayout : IMindLayout
|
||||
{
|
||||
public void Appearance(MindNode mindNode)
|
||||
public void Appearance(MindNode mindNode, bool initAppearance)
|
||||
{
|
||||
if (mindNode == null) return;
|
||||
|
||||
@@ -23,65 +23,72 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.None;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.BottomLeft, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.BottomLeft, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.TopLeft, true) { XRatio = 0, YRatio = 0 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.TopLeft, true) { XRatio = 0, YRatio = 0 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port3 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.25, YRatio = 0 };
|
||||
mindNode.AddConnector(port3);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port3 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.25, YRatio = 0 };
|
||||
mindNode.AddConnector(port3);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.FillColor.Color = Colors.Transparent;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Colors.Transparent;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public interface IMindLayout
|
||||
{
|
||||
void Appearance(MindNode mindNode);
|
||||
void Appearance(MindNode mindNode, bool initAppearance);
|
||||
ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null);
|
||||
void LayoutUpdated(MindNode mindNode);
|
||||
|
||||
|
||||
@@ -13,66 +13,72 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public class LogicalLayout : IMindLayout
|
||||
{
|
||||
public void Appearance(MindNode mindNode)
|
||||
public void Appearance(MindNode mindNode, bool initAppearance)
|
||||
{
|
||||
switch (mindNode.NodeLevel)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.None;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port2);
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,66 +13,72 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public class MindLayout : IMindLayout
|
||||
{
|
||||
public void Appearance(MindNode mindNode)
|
||||
public void Appearance(MindNode mindNode, bool initAppearance)
|
||||
{
|
||||
switch (mindNode.NodeLevel)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.Spacing = new SizeBase(50, 15);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.None;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port2);
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,44 +13,46 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
{
|
||||
public class OrganizationalLayout : IMindLayout
|
||||
{
|
||||
public void Appearance(MindNode mindNode)
|
||||
public void Appearance(MindNode mindNode, bool initAppearance)
|
||||
{
|
||||
switch (mindNode.NodeLevel)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 110;
|
||||
mindNode.ItemHeight = 40;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port);
|
||||
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.FontViewModel.FontColor = Colors.White;
|
||||
mindNode.FontViewModel.FontSize = 15;
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.None;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Top;
|
||||
@@ -58,21 +60,24 @@ namespace AIStudio.Wpf.Mind.Helpers
|
||||
}
|
||||
default:
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
if (initAppearance)
|
||||
{
|
||||
mindNode.ItemWidth = 80;
|
||||
mindNode.ItemHeight = 25;
|
||||
mindNode.ClearConnectors();
|
||||
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
|
||||
mindNode.AddConnector(port1);
|
||||
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
|
||||
mindNode.AddConnector(port2);
|
||||
|
||||
mindNode.IsInnerConnector = true;
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
|
||||
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
|
||||
}
|
||||
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.CornerRadius = new System.Windows.CornerRadius(0);
|
||||
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
|
||||
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
|
||||
mindNode.ConnectorOrientation = ConnectorOrientation.Top;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace AIStudio.Wpf.Flowchart.Models
|
||||
|
||||
mindNode.Spacing = Spacing;
|
||||
mindNode.Offset = Offset;
|
||||
mindNode.IsExpanded = IsExpanded;
|
||||
mindNode.IsExpanded = IsExpanded;
|
||||
mindNode.InitLayout(false);
|
||||
return mindNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -411,31 +411,44 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
protected override bool Delete(object parameter)
|
||||
{
|
||||
if (parameter is MindNode node)
|
||||
List<MindNode> nodes = new List<MindNode>();
|
||||
if (parameter is MindNode node1)
|
||||
{
|
||||
|
||||
nodes.Add(node1);
|
||||
}
|
||||
else if (parameter is IEnumerable<MindNode> para)
|
||||
{
|
||||
nodes.AddRange(para);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = SelectedItem as MindNode;
|
||||
nodes.AddRange(SelectedItems.OfType<MindNode>());
|
||||
}
|
||||
|
||||
if (node.IsEditing == true)
|
||||
if (nodes.FirstOrDefault()?.IsEditing != false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (node.Parent is MindNode parent)
|
||||
nodes = nodes.Except(new List<MindNode>{ RootItem }).ToList();
|
||||
|
||||
if (nodes.Any())
|
||||
{
|
||||
int index = parent.Children.IndexOf(node);
|
||||
Dictionary<MindNode, int> indexs = nodes.ToDictionary(p => p, p => p.ParentNode.Children.IndexOf(p));
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
() => {
|
||||
parent.RemoveChild(node, true);
|
||||
parent.LayoutUpdated();
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
node.ParentNode.RemoveChild(node, true);
|
||||
}
|
||||
RootItem.LayoutUpdated();
|
||||
},
|
||||
() => {
|
||||
parent.AddChild(node, index);
|
||||
parent.LayoutUpdated();
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
node.ParentNode.AddChild(node, indexs[node]);
|
||||
}
|
||||
RootItem.LayoutUpdated();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -512,6 +525,9 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
parent.Children = new System.Collections.ObjectModel.ObservableCollection<MindNode>(Items.OfType<MindNode>().Where(p => p.ParentId == parent.Id));
|
||||
foreach (var item in Items.OfType<MindNode>().Where(p => p.ParentId == parent.Id))
|
||||
{
|
||||
item.Parent = parent;
|
||||
item.InitLayout(false);
|
||||
item.InitConnectLayout();
|
||||
GetChildren(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,9 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
var layout = GlobalType.AllTypes.Where(p => typeof(IMindLayout).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == MindType.ToString() + "Layout");
|
||||
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
||||
|
||||
if (initAppearance)
|
||||
{
|
||||
MindLayout.Appearance(this);
|
||||
}
|
||||
IsInnerConnector = true;
|
||||
MindLayout.Appearance(this, initAppearance);
|
||||
|
||||
this.PropertyChanged -= this.Item_PropertyChanged;
|
||||
this.PropertyChanged += this.Item_PropertyChanged;
|
||||
}
|
||||
@@ -412,7 +411,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
var connector = Root?.Items.OfType<ConnectionViewModel>().Where(p => p.IsFullConnection).FirstOrDefault(p => p.SinkConnectorInfoFully.DataItem == this);
|
||||
if (connector != null)
|
||||
{
|
||||
MindLayout?.GetOrSetConnectionViewModel(connector.SourceConnectorInfo.DataItem as MindNode, connector.SinkConnectorInfoFully.DataItem as MindNode, connector);
|
||||
MindLayout?.GetOrSetConnectionViewModel(connector.SourceConnectorInfo.DataItem as MindNode, connector.SinkConnectorInfoFully.DataItem as MindNode, connector);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -431,7 +430,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
break;
|
||||
}
|
||||
case nameof(NodeLevel):
|
||||
MindLayout?.Appearance(this);
|
||||
MindLayout?.Appearance(this, false);
|
||||
break;
|
||||
case nameof(Left):
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user