mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-04 06:51:28 +08:00
block
This commit is contained in:
@@ -19,9 +19,5 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
Connectors.Add(connector);
|
Connectors.Add(connector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[XmlArray]
|
|
||||||
public List<FullyCreatedConnectorInfoItem> Connectors { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
Children.Remove(child);
|
Children.Remove(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BlockItemsContainerInfo> GetAllContain(ObservableCollection<BlockDesignerItemViewModel> children, bool self)
|
public List<BlockItemsContainerInfo> GetAllContainers(ObservableCollection<BlockDesignerItemViewModel> children, bool self)
|
||||||
{
|
{
|
||||||
List<BlockItemsContainerInfo> itemsContainers = new List<BlockItemsContainerInfo>();
|
List<BlockItemsContainerInfo> itemsContainers = new List<BlockItemsContainerInfo>();
|
||||||
if (self)
|
if (self)
|
||||||
@@ -264,7 +264,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
foreach (var container in item.Containers)
|
foreach (var container in item.Containers)
|
||||||
{
|
{
|
||||||
itemsContainers.Add(container);
|
itemsContainers.Add(container);
|
||||||
itemsContainers.AddRange(container.GetAllContain(container.Children, false));
|
itemsContainers.AddRange(container.GetAllContainers(container.Children, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3221,7 +3221,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
if (port.GetBounds().IntersectsWith(blockDesignerItemViewModel.GetBounds())) //如果两个位置相交
|
if (port.GetBounds().IntersectsWith(blockDesignerItemViewModel.GetBounds())) //如果两个位置相交
|
||||||
{
|
{
|
||||||
var innerport = port.GetAllContain(port.Children, false).Where(p => p.GetBounds().IntersectsWith(blockDesignerItemViewModel.GetBounds())).OrderByDescending(p => p.ContainerLevel).FirstOrDefault();
|
var innerport = port.GetAllContainers(port.Children, false).Where(p => p.GetBounds().IntersectsWith(blockDesignerItemViewModel.GetBounds())).OrderByDescending(p => p.ContainerLevel).FirstOrDefault();
|
||||||
if (innerport != null)
|
if (innerport != null)
|
||||||
{
|
{
|
||||||
innerport.DataItem.ShowConnectors = true;
|
innerport.DataItem.ShowConnectors = true;
|
||||||
@@ -3356,7 +3356,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
if (port.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())) //如果两个位置相交
|
if (port.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())) //如果两个位置相交
|
||||||
{
|
{
|
||||||
var innerport = port.GetAllContain(port.Children, false).Where(p => p.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())).OrderByDescending(p => p.ContainerLevel).FirstOrDefault();
|
var innerport = port.GetAllContainers(port.Children, false).Where(p => p.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())).OrderByDescending(p => p.ContainerLevel).FirstOrDefault();
|
||||||
if (innerport != null)
|
if (innerport != null)
|
||||||
{
|
{
|
||||||
innerport.DataItem.ShowConnectors = true;
|
innerport.DataItem.ShowConnectors = true;
|
||||||
@@ -3403,7 +3403,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
public void ClearNearContain()
|
public void ClearNearContain()
|
||||||
{
|
{
|
||||||
Items.OfType<BlockDesignerItemViewModel>().ToList().SelectMany(n => n.GetAllContain()).Where(p => p.BeAttachTo == true || p.DisableAttachTo == true).ToList()
|
Items.OfType<BlockDesignerItemViewModel>().ToList().SelectMany(n => n.GetAllContainers()).Where(p => p.BeAttachTo == true || p.DisableAttachTo == true).ToList()
|
||||||
.ForEach(p => {
|
.ForEach(p => {
|
||||||
p.DisableAttachTo = false;
|
p.DisableAttachTo = false;
|
||||||
p.BeAttachTo = false;
|
p.BeAttachTo = false;
|
||||||
|
|||||||
@@ -245,9 +245,33 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BlockItemsContainerInfo> GetAllContain()
|
public void AddContainer(BlockItemsContainerInfo container)
|
||||||
{
|
{
|
||||||
return Containers.SelectMany(p => p.GetAllContain(p.Children, true)).ToList();
|
Containers.Add(container);
|
||||||
|
RaisePropertyChanged(nameof(FirstContainer));
|
||||||
|
RaisePropertyChanged(nameof(SecondContainer));
|
||||||
|
RaisePropertyChanged(nameof(ThirdContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveContainer(BlockItemsContainerInfo container)
|
||||||
|
{
|
||||||
|
Containers.Remove(container);
|
||||||
|
RaisePropertyChanged(nameof(FirstContainer));
|
||||||
|
RaisePropertyChanged(nameof(SecondContainer));
|
||||||
|
RaisePropertyChanged(nameof(ThirdContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearContainers()
|
||||||
|
{
|
||||||
|
Containers.Clear();
|
||||||
|
RaisePropertyChanged(nameof(FirstContainer));
|
||||||
|
RaisePropertyChanged(nameof(SecondContainer));
|
||||||
|
RaisePropertyChanged(nameof(ThirdContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BlockItemsContainerInfo> GetAllContainers()
|
||||||
|
{
|
||||||
|
return Containers.SelectMany(p => p.GetAllContainers(p.Children, true)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockDesignerItemViewModel GetRootContainItem
|
public BlockDesignerItemViewModel GetRootContainItem
|
||||||
|
|||||||
Reference in New Issue
Block a user