mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-27 11:43:24 +08:00
mind的拷贝完成
This commit is contained in:
@@ -276,6 +276,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
|||||||
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkInnerPoint);
|
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkInnerPoint);
|
||||||
|
|
||||||
ConnectionViewModel connectionVM = new ConnectionViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
ConnectionViewModel connectionVM = new ConnectionViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
||||||
|
connectionVM.Id = Guid.NewGuid();
|
||||||
viewModel.Items.Add(connectionVM);
|
viewModel.Items.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,6 +477,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
|||||||
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkIsPortless);
|
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkIsPortless);
|
||||||
|
|
||||||
ConnectionViewModel connectionVM = new ConnectionViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
ConnectionViewModel connectionVM = new ConnectionViewModel(viewModel, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
||||||
|
connectionVM.Id = Guid.NewGuid();
|
||||||
viewModel.Items.Add(connectionVM);
|
viewModel.Items.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ namespace AIStudio.Wpf.DiagramDesigner.Models
|
|||||||
Type itemtype = TypeHelper.GetType(connection.SerializableTypeName);
|
Type itemtype = TypeHelper.GetType(connection.SerializableTypeName);
|
||||||
var connectionItem = SerializeHelper.DeserializeObject(itemtype, connection.SerializableString, ".json") as ConnectionItem;
|
var connectionItem = SerializeHelper.DeserializeObject(itemtype, connection.SerializableString, ".json") as ConnectionItem;
|
||||||
|
|
||||||
connectionItem.SourceType = System.Type.GetType(connectionItem.SourceTypeName);
|
connectionItem.SourceType = TypeHelper.GetType(connectionItem.SourceTypeName);
|
||||||
connectionItem.SinkType = System.Type.GetType(connectionItem.SinkTypeName);
|
connectionItem.SinkType = TypeHelper.GetType(connectionItem.SinkTypeName);
|
||||||
DesignerItemViewModelBase sourceItem = DiagramViewModelHelper.GetConnectorDataItem(items, connectionItem.SourceId, connectionItem.SourceType);
|
DesignerItemViewModelBase sourceItem = DiagramViewModelHelper.GetConnectorDataItem(items, connectionItem.SourceId, connectionItem.SourceType);
|
||||||
if (sourceItem == null)
|
if (sourceItem == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -81,6 +81,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Models
|
|||||||
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkInnerPoint);
|
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkInnerPoint);
|
||||||
|
|
||||||
ConnectionViewModel connectionVM = new ConnectionViewModel(null, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
ConnectionViewModel connectionVM = new ConnectionViewModel(null, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
||||||
|
connectionVM.Id = Guid.NewGuid();
|
||||||
connects.Add(connectionVM);
|
connects.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
this.ShapeViewModel.PropertyChanged += ConnectorViewModel_PropertyChanged;
|
this.ShapeViewModel.PropertyChanged += ConnectorViewModel_PropertyChanged;
|
||||||
this.PropertyChanged += ConnectorViewModel_PropertyChanged;
|
this.PropertyChanged += ConnectorViewModel_PropertyChanged;
|
||||||
|
|
||||||
var routetype = GlobalType.AllTypes.Where(p => typeof(IRouter).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == RouterMode);
|
var routetype = TypeHelper.GetType(RouterMode);
|
||||||
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
|
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
|
||||||
|
|
||||||
var pathGeneratortype = GlobalType.AllTypes.Where(p => typeof(IPathGenerator).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == PathMode);
|
var pathGeneratortype = TypeHelper.GetType(PathMode);
|
||||||
PathGenerator = pathGeneratortype != null ? (System.Activator.CreateInstance(pathGeneratortype) as IPathGenerator) : new ConnectingLineSmooth();
|
PathGenerator = pathGeneratortype != null ? (System.Activator.CreateInstance(pathGeneratortype) as IPathGenerator) : new ConnectingLineSmooth();
|
||||||
|
|
||||||
this.SourceConnectorInfo = sourceConnectorInfo;
|
this.SourceConnectorInfo = sourceConnectorInfo;
|
||||||
@@ -497,12 +497,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nameof(RouterMode):
|
case nameof(RouterMode):
|
||||||
var routetype = GlobalType.AllTypes.Where(p => typeof(IRouter).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == RouterMode);
|
var routetype = TypeHelper.GetType(RouterMode);
|
||||||
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
|
Router = routetype != null ? (System.Activator.CreateInstance(routetype) as IRouter) : new RouterNormal();
|
||||||
UpdatePathGeneratorResult();
|
UpdatePathGeneratorResult();
|
||||||
break;
|
break;
|
||||||
case nameof(PathMode):
|
case nameof(PathMode):
|
||||||
var pathGeneratortype = GlobalType.AllTypes.Where(p => typeof(IPathGenerator).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == PathMode);
|
var pathGeneratortype = TypeHelper.GetType(PathMode);
|
||||||
PathGenerator = pathGeneratortype != null ? (System.Activator.CreateInstance(pathGeneratortype) as IPathGenerator) : new ConnectingLineSmooth();
|
PathGenerator = pathGeneratortype != null ? (System.Activator.CreateInstance(pathGeneratortype) as IPathGenerator) : new ConnectingLineSmooth();
|
||||||
UpdatePathGeneratorResult();
|
UpdatePathGeneratorResult();
|
||||||
break;
|
break;
|
||||||
@@ -729,6 +729,35 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
SinkConnectorInfo = sink;
|
SinkConnectorInfo = sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetPathGeneratorParameter(double smoothMargin, double smoothAutoSlope, double orthogonalShapeMargin, double orthogonalGlobalBoundsMargin)
|
||||||
|
{
|
||||||
|
bool hasChanged = false;
|
||||||
|
if (SmoothMargin != smoothMargin)
|
||||||
|
{
|
||||||
|
hasChanged = true;
|
||||||
|
SmoothMargin = smoothMargin;
|
||||||
|
}
|
||||||
|
if (SmoothAutoSlope != smoothAutoSlope)
|
||||||
|
{
|
||||||
|
hasChanged = true;
|
||||||
|
SmoothAutoSlope = smoothAutoSlope;
|
||||||
|
}
|
||||||
|
if (OrthogonalShapeMargin != orthogonalShapeMargin)
|
||||||
|
{
|
||||||
|
hasChanged = true;
|
||||||
|
OrthogonalShapeMargin = orthogonalShapeMargin;
|
||||||
|
}
|
||||||
|
if (OrthogonalGlobalBoundsMargin != orthogonalGlobalBoundsMargin)
|
||||||
|
{
|
||||||
|
hasChanged = true;
|
||||||
|
OrthogonalGlobalBoundsMargin = orthogonalGlobalBoundsMargin;
|
||||||
|
}
|
||||||
|
if (hasChanged)
|
||||||
|
{
|
||||||
|
UpdatePathGeneratorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetVisible(bool visible)
|
public void SetVisible(bool visible)
|
||||||
{
|
{
|
||||||
Visible = visible;
|
Visible = visible;
|
||||||
|
|||||||
@@ -318,6 +318,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
public virtual bool CanAttachTo(FullyCreatedConnectorInfo port)
|
public virtual bool CanAttachTo(FullyCreatedConnectorInfo port)
|
||||||
=> port != this && !port.IsReadOnly && DataItem != port.DataItem;
|
=> port != this && !port.IsReadOnly && DataItem != port.DataItem;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"({GetXRatioFromConnector()},{GetYRatioFromConnector()})";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -634,8 +634,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
public event DiagramEventHandler Event;
|
public event DiagramEventHandler Event;
|
||||||
|
|
||||||
private double OffsetX = 10;
|
protected double OffsetX = 10;
|
||||||
private double OffsetY = 10;
|
protected double OffsetY = 10;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 命令
|
#region 命令
|
||||||
@@ -1508,8 +1508,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
Connections = selectedConnections.Select(p => p.ToSerializableItem(".json")).Where(p => p != null).ToList(),
|
Connections = selectedConnections.Select(p => p.ToSerializableItem(".json")).Where(p => p != null).ToList(),
|
||||||
}.ToJson();
|
}.ToJson();
|
||||||
|
|
||||||
OffsetX = 10;
|
OffsetX = 0;
|
||||||
OffsetY = 10;
|
OffsetY = 0;
|
||||||
System.Windows.Clipboard.Clear();
|
System.Windows.Clipboard.Clear();
|
||||||
System.Windows.Clipboard.SetData(System.Windows.DataFormats.Serializable, json);
|
System.Windows.Clipboard.SetData(System.Windows.DataFormats.Serializable, json);
|
||||||
|
|
||||||
@@ -1531,6 +1531,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
return false;
|
return false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
OffsetX += 10;
|
||||||
|
OffsetY += 10;
|
||||||
|
|
||||||
List<SelectableDesignerItemViewModelBase> items = new List<SelectableDesignerItemViewModelBase>();
|
List<SelectableDesignerItemViewModelBase> items = new List<SelectableDesignerItemViewModelBase>();
|
||||||
SerializableObject copyitem = JsonConvert.DeserializeObject<SerializableObject>(clipboardData);
|
SerializableObject copyitem = JsonConvert.DeserializeObject<SerializableObject>(clipboardData);
|
||||||
|
|
||||||
@@ -1557,9 +1560,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OffsetX += 10;
|
|
||||||
OffsetY += 10;
|
|
||||||
|
|
||||||
List<SelectableDesignerItemViewModelBase> connectors = new List<SelectableDesignerItemViewModelBase>();
|
List<SelectableDesignerItemViewModelBase> connectors = new List<SelectableDesignerItemViewModelBase>();
|
||||||
foreach (var connection in copyitem.Connections)
|
foreach (var connection in copyitem.Connections)
|
||||||
{
|
{
|
||||||
@@ -1570,8 +1570,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
connectionItem.SourceId = mappingOldToNewIDs[connectionItem.SourceId];
|
connectionItem.SourceId = mappingOldToNewIDs[connectionItem.SourceId];
|
||||||
connectionItem.SinkId = mappingOldToNewIDs[connectionItem.SinkId];
|
connectionItem.SinkId = mappingOldToNewIDs[connectionItem.SinkId];
|
||||||
|
|
||||||
connectionItem.SourceType = System.Type.GetType(connectionItem.SourceTypeName);
|
connectionItem.SourceType = TypeHelper.GetType(connectionItem.SourceTypeName);
|
||||||
connectionItem.SinkType = System.Type.GetType(connectionItem.SinkTypeName);
|
connectionItem.SinkType = TypeHelper.GetType(connectionItem.SinkTypeName);
|
||||||
DesignerItemViewModelBase sourceItem = DiagramViewModelHelper.GetConnectorDataItem(items, connectionItem.SourceId, connectionItem.SourceType);
|
DesignerItemViewModelBase sourceItem = DiagramViewModelHelper.GetConnectorDataItem(items, connectionItem.SourceId, connectionItem.SourceType);
|
||||||
ConnectorOrientation sourceConnectorOrientation = connectionItem.SourceOrientation;
|
ConnectorOrientation sourceConnectorOrientation = connectionItem.SourceOrientation;
|
||||||
FullyCreatedConnectorInfo sourceConnectorInfo = sourceItem.GetFullConnectorInfo(connectionItem.Id, sourceConnectorOrientation, connectionItem.SourceXRatio, connectionItem.SourceYRatio, connectionItem.SourceInnerPoint, connectionItem.SourceIsPortless);
|
FullyCreatedConnectorInfo sourceConnectorInfo = sourceItem.GetFullConnectorInfo(connectionItem.Id, sourceConnectorOrientation, connectionItem.SourceXRatio, connectionItem.SourceYRatio, connectionItem.SourceInnerPoint, connectionItem.SourceIsPortless);
|
||||||
@@ -1581,6 +1581,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkIsPortless);
|
FullyCreatedConnectorInfo sinkConnectorInfo = sinkItem.GetFullConnectorInfo(connectionItem.Id, sinkConnectorOrientation, connectionItem.SinkXRatio, connectionItem.SinkYRatio, connectionItem.SinkInnerPoint, connectionItem.SinkIsPortless);
|
||||||
|
|
||||||
ConnectionViewModel connectionVM = new ConnectionViewModel(this, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
ConnectionViewModel connectionVM = new ConnectionViewModel(this, sourceConnectorInfo, sinkConnectorInfo, connectionItem);
|
||||||
|
connectionVM.Id = Guid.NewGuid();
|
||||||
connectors.Add(connectionVM);
|
connectors.Add(connectionVM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1634,8 +1635,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
if (Paste(null) == false)
|
if (Paste(null) == false)
|
||||||
return false;
|
return false;
|
||||||
OffsetX = 0;
|
|
||||||
OffsetY = 0;
|
|
||||||
if (Delete(null) == false)
|
if (Delete(null) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -2102,6 +2102,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteSendToBackCommand(object parameter)
|
private void ExecuteSendToBackCommand(object parameter)
|
||||||
{
|
{
|
||||||
List<SelectableDesignerItemViewModelBase> selectionSorted;
|
List<SelectableDesignerItemViewModelBase> selectionSorted;
|
||||||
@@ -2151,6 +2152,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteDistributeHorizontalCommand(object parameter)
|
private void ExecuteDistributeHorizontalCommand(object parameter)
|
||||||
{
|
{
|
||||||
IEnumerable<DesignerItemViewModelBase> selectedItems;
|
IEnumerable<DesignerItemViewModelBase> selectedItems;
|
||||||
@@ -2214,6 +2216,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteDistributeVerticalCommand(object parameter)
|
private void ExecuteDistributeVerticalCommand(object parameter)
|
||||||
{
|
{
|
||||||
IEnumerable<DesignerItemViewModelBase> selectedItems;
|
IEnumerable<DesignerItemViewModelBase> selectedItems;
|
||||||
|
|||||||
@@ -89,13 +89,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
||||||
}
|
}
|
||||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
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.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||||
|
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||||
return connector;
|
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.Left = left + child.DesiredSize.Width / 2 - child.ItemWidth / 2 + child.Offset.X;
|
||||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
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;
|
left += child.DesiredSize.Width;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -158,6 +154,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.SetVisible(child.Visible);
|
connector?.SetVisible(child.Visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mindNode.DesiredPosition = mindNode.Position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -169,7 +167,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = left + child.Offset.X;
|
child.Left = left + child.Offset.X;
|
||||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
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;
|
top += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
|
|||||||
@@ -115,12 +115,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, drawMode.ToString(), routerMode.ToString());
|
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, drawMode.ToString(), routerMode.ToString());
|
||||||
}
|
}
|
||||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
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.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||||
|
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||||
|
|
||||||
return connector;
|
return connector;
|
||||||
}
|
}
|
||||||
@@ -186,7 +183,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = topleft + child.Spacing.Width + child.Offset.X;
|
child.Left = topleft + child.Spacing.Width + child.Offset.X;
|
||||||
child.Top = toptop - child.ItemHeight - child.Spacing.Height + child.Offset.Y;
|
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;
|
topleft += child.DesiredSize.Width;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -209,7 +206,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = bottomleft + child.Spacing.Width + child.Offset.X;
|
child.Left = bottomleft + child.Spacing.Width + child.Offset.X;
|
||||||
child.Top = bottomtop + child.Spacing.Height + child.Offset.Y;
|
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;
|
bottomleft += child.DesiredSize.Width;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -220,6 +217,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.SetVisible(child.Visible);
|
connector?.SetVisible(child.Visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mindNode.DesiredPosition = mindNode.Position;
|
||||||
}
|
}
|
||||||
else if (mindNode.NodeLevel == 1)
|
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.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.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;
|
h += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
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.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.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;
|
h += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -282,7 +281,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = left + child.Offset.X;
|
child.Left = left + child.Offset.X;
|
||||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
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;
|
top += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -304,7 +303,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = left + child.Offset.X;
|
child.Left = left + child.Offset.X;
|
||||||
child.Top = bottom - child.Spacing.Height - child.ItemHeight + child.Offset.Y;
|
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;
|
bottom -= child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
|
|||||||
@@ -87,12 +87,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineSmooth.ToString(), RouterMode.RouterNormal.ToString());
|
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineSmooth.ToString(), RouterMode.RouterNormal.ToString());
|
||||||
}
|
}
|
||||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
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.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||||
|
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||||
|
|
||||||
return connector;
|
return connector;
|
||||||
}
|
}
|
||||||
@@ -134,7 +131,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||||
child.Top = top + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
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;
|
top += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -144,6 +141,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.SetSinkPort(child.LeftConnector);
|
connector?.SetSinkPort(child.LeftConnector);
|
||||||
connector?.SetVisible(child.Visible);
|
connector?.SetVisible(child.Visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mindNode.DesiredPosition = mindNode.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,12 +89,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
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.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||||
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
connector.ShapeViewModel.SinkMarker.SizeStyle = source.ShapeViewModel.SinkMarker.SizeStyle;
|
||||||
|
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||||
|
|
||||||
return connector;
|
return connector;
|
||||||
}
|
}
|
||||||
@@ -145,14 +142,14 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
if (mindNode.Children?.Count > 0)
|
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 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;
|
double lefttop = mindNode.MiddlePosition.Y - Math.Min(mindNode.DesiredSize.Height, rights.SumOrDefault(p => p.DesiredSize.Height)) / 2;
|
||||||
foreach (var child in rights)
|
foreach (var child in rights)
|
||||||
{
|
{
|
||||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||||
child.Top = lefttop + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
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;
|
lefttop += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -170,7 +167,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
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.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;
|
righttop += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -181,6 +178,8 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.SetVisible(child.Visible);
|
connector?.SetVisible(child.Visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mindNode.DesiredPosition = mindNode.Position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -194,7 +193,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = left + child.Spacing.Width + child.Offset.X;
|
child.Left = left + child.Spacing.Width + child.Offset.X;
|
||||||
child.Top = top + child.DesiredSize.Height / 2 - child.ItemHeight / 2 + child.Offset.Y;
|
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;
|
top += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -216,7 +215,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
child.Left = right - child.Spacing.Width - child.ItemWidth + child.Offset.X;
|
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.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;
|
top += child.DesiredSize.Height;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -230,6 +229,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -496,6 +496,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
Name = "冷光黄",
|
Name = "冷光黄",
|
||||||
Key = "CoolLightYellow",
|
Key = "CoolLightYellow",
|
||||||
|
Dark = true,
|
||||||
MindThemeLevel1 = new MindTheme()
|
MindThemeLevel1 = new MindTheme()
|
||||||
{
|
{
|
||||||
ItemWidth = 110,
|
ItemWidth = 110,
|
||||||
@@ -534,6 +535,7 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
Name = "紧凑黄",
|
Name = "紧凑黄",
|
||||||
Key = "CoolLightYellowMini",
|
Key = "CoolLightYellowMini",
|
||||||
|
Dark = true,
|
||||||
MindThemeLevel1 = new MindTheme()
|
MindThemeLevel1 = new MindTheme()
|
||||||
{
|
{
|
||||||
ItemWidth = 110,
|
ItemWidth = 110,
|
||||||
@@ -650,6 +652,10 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
public bool Dark
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
public MindTheme MindThemeLevel1
|
public MindTheme MindThemeLevel1
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
|||||||
@@ -89,12 +89,9 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
connector?.UpdateConnectionMode(source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight.ToString(), RouterMode.RouterOrthogonal.ToString());
|
||||||
}
|
}
|
||||||
connector.ColorViewModel.LineColor = source.ColorViewModel.LineColor;
|
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.PathStyle = source.ShapeViewModel.SinkMarker.PathStyle;
|
||||||
connector.ShapeViewModel.SinkMarker.SizeStyle = sink.ShapeViewModel.SinkMarker.SizeStyle;
|
connector.ShapeViewModel.SinkMarker.SizeStyle = sink.ShapeViewModel.SinkMarker.SizeStyle;
|
||||||
|
connector.SetPathGeneratorParameter(smoothMargin: 20, smoothAutoSlope: 0.2, orthogonalShapeMargin: 2, orthogonalGlobalBoundsMargin: 5);
|
||||||
|
|
||||||
return connector;
|
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.Left = left + child.DesiredSize.Width / 2 - child.ItemWidth / 2 + child.Offset.X;
|
||||||
child.Top = top + child.Spacing.Height + child.Offset.Y;
|
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;
|
left += child.DesiredSize.Width;
|
||||||
|
|
||||||
ArrangeOverride(child);
|
ArrangeOverride(child);
|
||||||
@@ -146,6 +143,12 @@ namespace AIStudio.Wpf.Mind.Helpers
|
|||||||
connector?.SetSinkPort(child.TopConnector);
|
connector?.SetSinkPort(child.TopConnector);
|
||||||
connector?.SetVisible(child.Visible);
|
connector?.SetVisible(child.Visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mindNode.NodeLevel == 0)
|
||||||
|
{
|
||||||
|
mindNode.DesiredPosition = mindNode.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using AIStudio.Wpf.DiagramDesigner;
|
using AIStudio.Wpf.DiagramDesigner;
|
||||||
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||||
using AIStudio.Wpf.Mind.Helpers;
|
using AIStudio.Wpf.Mind.Helpers;
|
||||||
|
|
||||||
namespace AIStudio.Wpf.Mind.ViewModels
|
namespace AIStudio.Wpf.Mind.ViewModels
|
||||||
@@ -426,7 +427,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
|
|
||||||
if (items?.Count == 0)
|
if (items?.Count == 0)
|
||||||
{
|
{
|
||||||
var node = new MindNode(this) { Text = $"分支主题{parent.Children.Count + 1}"};
|
var node = new MindNode(this) { Text = $"分支主题{parent.Children.Count + 1}" };
|
||||||
items.Add(node);
|
items.Add(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,6 +617,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
protected override bool Delete(object parameter)
|
protected override bool Delete(object parameter)
|
||||||
{
|
{
|
||||||
List<MindNode> nodes = new List<MindNode>();
|
List<MindNode> nodes = new List<MindNode>();
|
||||||
|
List<SelectableDesignerItemViewModelBase> others = new List<SelectableDesignerItemViewModelBase>();
|
||||||
if (parameter is MindNode node1)
|
if (parameter is MindNode node1)
|
||||||
{
|
{
|
||||||
nodes.Add(node1);
|
nodes.Add(node1);
|
||||||
@@ -627,6 +629,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
nodes.AddRange(SelectedItems.OfType<MindNode>());
|
nodes.AddRange(SelectedItems.OfType<MindNode>());
|
||||||
|
|
||||||
|
others = SelectedItems.Where(p => !(p is MindNode)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.FirstOrDefault()?.IsEditing != false)
|
if (nodes.FirstOrDefault()?.IsEditing != false)
|
||||||
@@ -641,16 +645,14 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
() => {
|
() => {
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
{
|
{
|
||||||
if (node.NodeLevel == 0)
|
node.Remove(true);
|
||||||
{
|
|
||||||
DirectRemoveItemCommand.Execute(node);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
node.ParentNode?.RemoveChild(node, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
RootItems.ForEach(p => p.LayoutUpdated());
|
RootItems.ForEach(p => p.LayoutUpdated());
|
||||||
|
|
||||||
|
if (others.Any())
|
||||||
|
{
|
||||||
|
base.Delete(others);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
@@ -669,9 +671,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
#region 复制,粘贴
|
#region 复制,粘贴
|
||||||
protected override void FixOtherInfo(List<SelectableDesignerItemViewModelBase> items)
|
protected override void FixOtherInfo(List<SelectableDesignerItemViewModelBase> items)
|
||||||
{
|
{
|
||||||
|
|
||||||
List<MindNode> parents = new List<MindNode>();
|
List<MindNode> parents = new List<MindNode>();
|
||||||
foreach (var item in items.OfType<MindNode>())
|
foreach (var item in items.OfType<MindNode>())
|
||||||
{
|
{
|
||||||
|
//item.DesiredPosition = new PointBase(item.DesiredPosition?.X ?? 0 + OffsetX, item.DesiredPosition?.Y ?? 0 + OffsetY);
|
||||||
var parent = Items.OfType<MindNode>().FirstOrDefault(p => p.Id == item.ParentId);
|
var parent = Items.OfType<MindNode>().FirstOrDefault(p => p.Id == item.ParentId);
|
||||||
if (parent != null && !items.Contains(parent))
|
if (parent != null && !items.Contains(parent))
|
||||||
{
|
{
|
||||||
@@ -679,6 +683,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
}
|
}
|
||||||
else if (item.ParentId == Guid.Empty)
|
else if (item.ParentId == Guid.Empty)
|
||||||
{
|
{
|
||||||
|
item.Offset = new PointBase(OffsetX, OffsetX);
|
||||||
parents.Add(item);
|
parents.Add(item);
|
||||||
item.InitLayout(false);
|
item.InitLayout(false);
|
||||||
}
|
}
|
||||||
@@ -806,7 +811,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
if (obj is string mindThemeModel)
|
if (obj is string mindThemeModel)
|
||||||
{
|
{
|
||||||
MindThemeModel = MindThemeHelper.GetTheme(mindThemeModel);
|
MindThemeModel = MindThemeHelper.GetTheme(mindThemeModel);
|
||||||
if (mindThemeModel.StartsWith("CoolLightYellow"))
|
if (MindThemeModel?.Dark == true)
|
||||||
{
|
{
|
||||||
PageBackground = Colors.Black;
|
PageBackground = Colors.Black;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,13 +98,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
|
|
||||||
public void InitLayout(bool initAppearance)
|
public void InitLayout(bool initAppearance)
|
||||||
{
|
{
|
||||||
var layout = GlobalType.AllTypes.Where(p => typeof(IMindLayout).IsAssignableFrom(p)).FirstOrDefault(p => p.Name == MindType.ToString() + "Layout");
|
var layout = TypeHelper.GetType(MindType.ToString() + "Layout");
|
||||||
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
||||||
|
|
||||||
|
this.PropertyChanged -= this.Item_PropertyChanged;
|
||||||
IsInnerConnector = true;
|
IsInnerConnector = true;
|
||||||
MindLayout.Appearance(this, MindThemeModel, initAppearance);
|
MindLayout.Appearance(this, MindThemeModel, initAppearance);
|
||||||
|
|
||||||
this.PropertyChanged -= this.Item_PropertyChanged;
|
|
||||||
this.PropertyChanged += this.Item_PropertyChanged;
|
this.PropertyChanged += this.Item_PropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,14 +230,51 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointBase DesiredPosition
|
public PointBase? DesiredPosition
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointBase Offset
|
public PointBase Offset
|
||||||
{
|
{
|
||||||
get; set;
|
get
|
||||||
|
{
|
||||||
|
PointBase point;
|
||||||
|
if (NodeLevel == 0)
|
||||||
|
{
|
||||||
|
if (DesiredPosition == null)
|
||||||
|
{
|
||||||
|
point = new PointBase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point = new PointBase(Position.X - DesiredPosition.Value.X, Position.Y - DesiredPosition.Value.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (DesiredPosition == null)
|
||||||
|
{
|
||||||
|
point = new PointBase();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point = new PointBase(Position.X - DesiredPosition.Value.X - RootNode.Offset.X, Position.Y - DesiredPosition.Value.Y - RootNode.Offset.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (NodeLevel == 0)
|
||||||
|
{
|
||||||
|
DesiredPosition = new PointBase(Position.X - value.X, Position.Y - value.Y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DesiredPosition = new PointBase(Position.X - value.X - RootNode.Offset.X, Position.Y - value.Y - RootNode.Offset.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConnectorOrientation _connectorOrientation = ConnectorOrientation.Left;
|
private ConnectorOrientation _connectorOrientation = ConnectorOrientation.Left;
|
||||||
@@ -494,7 +530,31 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
{
|
{
|
||||||
foreach (var child in item.Children.ToList())
|
foreach (var child in item.Children.ToList())
|
||||||
{
|
{
|
||||||
item.RemoveChild(child);
|
item.RemoveChild(child, removeall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Remove(bool removeall = false)
|
||||||
|
{
|
||||||
|
this.PropertyChanged -= Item_PropertyChanged;
|
||||||
|
if (this.ParentNode != null)
|
||||||
|
{
|
||||||
|
this.ParentNode.Children.Remove(this);
|
||||||
|
}
|
||||||
|
var connectors = Root?.Items.OfType<ConnectionViewModel>().Where(p => p.SinkConnectorInfoFully?.DataItem == this).ToList();
|
||||||
|
|
||||||
|
Root?.DirectRemoveItemCommand.Execute(this);
|
||||||
|
Root?.DirectRemoveItemCommand.Execute(connectors);
|
||||||
|
|
||||||
|
if (removeall)
|
||||||
|
{
|
||||||
|
if (this.Children?.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var child in this.Children.ToList())
|
||||||
|
{
|
||||||
|
child.Remove(removeall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,8 +581,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
{
|
{
|
||||||
if (GetLevel1Node()?.LayoutUpdating == true) return;
|
if (GetLevel1Node()?.LayoutUpdating == true) return;
|
||||||
|
|
||||||
if (Root == null) return;
|
|
||||||
|
|
||||||
switch (e.PropertyName)
|
switch (e.PropertyName)
|
||||||
{
|
{
|
||||||
case nameof(IsExpanded):
|
case nameof(IsExpanded):
|
||||||
@@ -535,28 +593,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
case nameof(NodeLevel):
|
case nameof(NodeLevel):
|
||||||
MindLayout?.Appearance(this);
|
MindLayout?.Appearance(this);
|
||||||
break;
|
break;
|
||||||
case nameof(Left):
|
|
||||||
{
|
|
||||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
|
||||||
{
|
|
||||||
if (NodeLevel > 0 && IsSelected)
|
|
||||||
{
|
|
||||||
UpdateOffsetX((double)valuePropertyChangedEventArgs.OldValue, (double)valuePropertyChangedEventArgs.NewValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case nameof(Top):
|
|
||||||
{
|
|
||||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
|
||||||
{
|
|
||||||
if (NodeLevel > 0 && IsSelected)
|
|
||||||
{
|
|
||||||
UpdateOffsetY((double)valuePropertyChangedEventArgs.OldValue, (double)valuePropertyChangedEventArgs.NewValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case nameof(Text):
|
case nameof(Text):
|
||||||
{
|
{
|
||||||
ItemWidth = Math.Max(ItemWidth, GetTextDisplayWidthHelper.GetTextDisplayWidth(Text, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, FontViewModel.FontSize) + 30);
|
ItemWidth = Math.Max(ItemWidth, GetTextDisplayWidthHelper.GetTextDisplayWidth(Text, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, FontViewModel.FontSize) + 30);
|
||||||
|
|||||||
Reference in New Issue
Block a user