mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
添加block快,不需要连接线,直接吸附。
This commit is contained in:
@@ -101,16 +101,6 @@ namespace AIStudio.Wpf.Logical.ViewModels
|
||||
|
||||
}
|
||||
|
||||
protected override void InitNew()
|
||||
{
|
||||
base.InitNew();
|
||||
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
|
||||
public override bool EnableAddInput
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -471,7 +471,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
() => {
|
||||
if (rootitem != null)
|
||||
{
|
||||
Remove(rootitem);
|
||||
Delete(rootitem);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -785,7 +785,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
}
|
||||
|
||||
protected override List<SelectableDesignerItemViewModelBase> Delete(object parameter, bool delete = true)
|
||||
protected override List<SelectableDesignerItemViewModelBase> Delete(object parameter, bool delete = true, bool direct = true)
|
||||
{
|
||||
List<MindNode> items = new List<MindNode>();
|
||||
List<SelectableDesignerItemViewModelBase> others = new List<SelectableDesignerItemViewModelBase>();
|
||||
@@ -815,39 +815,42 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
//去重
|
||||
items = items.Distinct().ToList();
|
||||
|
||||
Dictionary<MindNode, Tuple<int, MindNode>> indexs = items.ToDictionary(p => p, p => new Tuple<int, MindNode>(p.ParentNode != null ? p.ParentNode.Children.IndexOf(p) : 0, p.ParentNode));
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
() => {
|
||||
if (delete)
|
||||
{
|
||||
Dictionary<MindNode, Tuple<int, MindNode>> indexs = items.ToDictionary(p => p, p => new Tuple<int, MindNode>(p.ParentNode != null ? p.ParentNode.Children.IndexOf(p) : 0, p.ParentNode));
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
() => {
|
||||
|
||||
foreach (var item in items.ToList())
|
||||
{
|
||||
item.RemoveFrom();
|
||||
}
|
||||
|
||||
if (others.Any())
|
||||
{
|
||||
base.Delete(others);
|
||||
}
|
||||
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
},
|
||||
() => {
|
||||
if (others.Any())
|
||||
{
|
||||
base.Add(others);
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
item.AddTo(indexs[item].Item2, indexs[item].Item1, false);
|
||||
if (item.ParentId == Guid.Empty)
|
||||
foreach (var item in items.ToList())
|
||||
{
|
||||
item.Offset = new PointBase();
|
||||
item.RemoveFrom();
|
||||
}
|
||||
}
|
||||
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
});
|
||||
if (others.Any())
|
||||
{
|
||||
base.Delete(others);
|
||||
}
|
||||
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
},
|
||||
() => {
|
||||
if (others.Any())
|
||||
{
|
||||
base.Add(others);
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
item.AddTo(indexs[item].Item2, indexs[item].Item1, false);
|
||||
if (item.ParentId == Guid.Empty)
|
||||
{
|
||||
item.Offset = new PointBase();
|
||||
}
|
||||
}
|
||||
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
});
|
||||
}
|
||||
return items.OfType<SelectableDesignerItemViewModelBase>().ToList();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -565,8 +565,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
var connectors = Root?.Items.OfType<ConnectionViewModel>().Where(p => p.SinkConnectorInfoFully?.DataItem == this).ToList();
|
||||
|
||||
Root?.Remove(this);
|
||||
Root?.Remove(connectors);
|
||||
Root?.Delete(this);
|
||||
Root?.Delete(connectors);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -745,12 +745,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
if (item != this)
|
||||
{
|
||||
item.IsSelected = false;
|
||||
item.RemoveFromSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Root.SelectedItems.Clear();
|
||||
IsSelected = selected;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user