mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 00:00:57 +08:00
修复demo中彩色节点的bug
This commit is contained in:
@@ -1367,7 +1367,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public bool AddVerify(SelectableDesignerItemViewModelBase item)
|
||||
{
|
||||
if (item.InitData() == false)
|
||||
if (item.Verify() == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1462,7 +1462,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Remove(olditems);
|
||||
},
|
||||
() => {
|
||||
Add(olditems);
|
||||
Add(olditems);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3298,9 +3298,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (SearchCaseMatch == true)
|
||||
{
|
||||
return input.Replace(searchtext, replcetext);
|
||||
return input.Replace(searchtext, replcetext);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return Regex.Replace(input, searchtext, replcetext, RegexOptions.IgnoreCase);
|
||||
}
|
||||
@@ -3362,22 +3362,38 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (connectorVertexType == ConnectorVertexType.Start)
|
||||
{
|
||||
if (partialConnection.SourceConnectorInfo.Position.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius &&
|
||||
partialConnection.SinkConnectorInfo?.CanAttachTo(port) == true)
|
||||
if (partialConnection.SourceConnectorInfo.Position.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius)
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
if (partialConnection.SinkConnectorInfo?.CanAttachTo(port) == true)
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
}
|
||||
else
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.DisableAttachTo = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (connectorVertexType == ConnectorVertexType.End)
|
||||
{
|
||||
if (partialConnection.SinkConnectorInfo.Position.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius &&
|
||||
partialConnection.SourceConnectorInfo?.CanAttachTo(port) == true)
|
||||
if (partialConnection.SinkConnectorInfo.Position.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius)
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
if (partialConnection.SourceConnectorInfo?.CanAttachTo(port) == true)
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
}
|
||||
else
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.DisableAttachTo = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3393,12 +3409,20 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
ClearNearPort();
|
||||
foreach (var port in Items.OfType<DesignerItemViewModelBase>().ToList().SelectMany(n => n.Connectors))
|
||||
{
|
||||
if (partialConnection.OnGoingPosition.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius &&
|
||||
partialConnection.SourceConnectorInfoFully?.CanAttachTo(port) == true)
|
||||
if (partialConnection.OnGoingPosition.DistanceTo(port.Position) < DiagramOption.SnappingOption.SnappingRadius)
|
||||
{
|
||||
port.DataItem.ShowConnectors = true;
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
if (partialConnection.SourceConnectorInfo?.CanAttachTo(port) == true)
|
||||
{
|
||||
port.BeAttachTo = true;
|
||||
return port;
|
||||
}
|
||||
else
|
||||
{
|
||||
port.DisableAttachTo = true;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3407,7 +3431,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public void ClearNearPort()
|
||||
{
|
||||
Items.OfType<DesignerItemViewModelBase>().ToList().SelectMany(n => n.Connectors).Where(p => p.BeAttachTo == true).ToList().ForEach(p => p.BeAttachTo = false);
|
||||
Items.OfType<DesignerItemViewModelBase>().ToList().SelectMany(n => n.Connectors).Where(p => p.BeAttachTo == true || p.DisableAttachTo == true).ToList()
|
||||
.ForEach(p => {
|
||||
p.DisableAttachTo = false;
|
||||
p.BeAttachTo = false;
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user