mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
mind不可删除修复
This commit is contained in:
@@ -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, bool direct = true)
|
||||
protected override void ExecuteDeleteCommand(object parameter)
|
||||
{
|
||||
List<MindNode> items = new List<MindNode>();
|
||||
List<SelectableDesignerItemViewModelBase> others = new List<SelectableDesignerItemViewModelBase>();
|
||||
@@ -815,47 +815,43 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
//去重
|
||||
items = items.Distinct().ToList();
|
||||
|
||||
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())
|
||||
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)
|
||||
{
|
||||
item.RemoveFrom();
|
||||
item.Offset = new PointBase();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout());
|
||||
});
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 复制,粘贴
|
||||
|
||||
Reference in New Issue
Block a user