mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
支持多个node保存到工具栏,显示还有点问题。
This commit is contained in:
@@ -779,8 +779,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
item.Id = Guid.NewGuid();
|
||||
}
|
||||
//item.LineColor = this.LineColor;
|
||||
//item.FillColor = this.FillColor;
|
||||
|
||||
var logical = item as LogicalGateItemViewModelBase;
|
||||
if (logical != null && logical.LogicalType > 0)
|
||||
{
|
||||
@@ -1479,11 +1478,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
connectionItem.SinkType = System.Type.GetType(connectionItem.SinkTypeName);
|
||||
DesignerItemViewModelBase sourceItem = GetConnectorDataItem(this, connectionItem.SourceId, connectionItem.SourceType);
|
||||
ConnectorOrientation sourceConnectorOrientation = connectionItem.SourceOrientation;
|
||||
FullyCreatedConnectorInfo sourceConnectorInfo = GetFullConnectorInfo(connectionItem.Id, sourceItem, sourceConnectorOrientation, connectionItem.SourceXRatio, connectionItem.SourceYRatio, connectionItem.SourceInnerPoint, connectionItem.SourceIsPortless);
|
||||
FullyCreatedConnectorInfo sourceConnectorInfo = sourceItem.GetFullConnectorInfo(connectionItem.Id, sourceConnectorOrientation, connectionItem.SourceXRatio, connectionItem.SourceYRatio, connectionItem.SourceInnerPoint, connectionItem.SourceIsPortless);
|
||||
|
||||
DesignerItemViewModelBase sinkItem = GetConnectorDataItem(this, connectionItem.SinkId, connectionItem.SinkType);
|
||||
ConnectorOrientation sinkConnectorOrientation = connectionItem.SinkOrientation;
|
||||
FullyCreatedConnectorInfo sinkConnectorInfo = GetFullConnectorInfo(connectionItem.Id, sinkItem, 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);
|
||||
connectors.Add(connectionVM);
|
||||
@@ -1512,45 +1511,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
DesignerItemViewModelBase dataItem = diagramViewModel.Items.OfType<DesignerItemViewModelBase>().Single(x => x.Id == conectorDataItemId);
|
||||
return dataItem;
|
||||
}
|
||||
|
||||
private FullyCreatedConnectorInfo GetFullConnectorInfo(Guid connectorId, DesignerItemViewModelBase dataItem, ConnectorOrientation connectorOrientation, double xRatio, double yRatio, bool isInnerPoint, bool isPortless)
|
||||
{
|
||||
if (isInnerPoint)
|
||||
{
|
||||
return dataItem.Connectors.Where(p => p.XRatio == xRatio && p.YRatio == yRatio).FirstOrDefault();
|
||||
}
|
||||
else if (isPortless)
|
||||
{
|
||||
return dataItem.PortlessConnector;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (connectorOrientation)
|
||||
{
|
||||
case ConnectorOrientation.Left:
|
||||
return dataItem.LeftConnector;
|
||||
case ConnectorOrientation.TopLeft:
|
||||
return dataItem.TopLeftConnector;
|
||||
case ConnectorOrientation.Top:
|
||||
return dataItem.TopConnector;
|
||||
case ConnectorOrientation.TopRight:
|
||||
return dataItem.TopRightConnector;
|
||||
case ConnectorOrientation.Right:
|
||||
return dataItem.RightConnector;
|
||||
case ConnectorOrientation.BottomRight:
|
||||
return dataItem.BottomRightConnector;
|
||||
case ConnectorOrientation.Bottom:
|
||||
return dataItem.BottomConnector;
|
||||
case ConnectorOrientation.BottomLeft:
|
||||
return dataItem.BottomLeftConnector;
|
||||
|
||||
default:
|
||||
throw new InvalidOperationException(
|
||||
string.Format("Found invalid persisted Connector Orientation for Connector Id: {0}", connectorId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ItemsToDeleteHasConnector(List<SelectableDesignerItemViewModelBase> itemsToRemove, ConnectorInfoBase connector)
|
||||
{
|
||||
@@ -1782,10 +1743,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public RectangleBase GetBoundingRectangle(IEnumerable<DesignerItemViewModelBase> items)
|
||||
{
|
||||
double x1 = Double.MaxValue;
|
||||
|
||||
Reference in New Issue
Block a user