您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
60 行
1.5 KiB
60 行
1.5 KiB
/*using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.Graphing.Drawing
|
|
{
|
|
internal class DeleteSelected : IManipulate
|
|
{
|
|
public delegate void DeleteElements(List<CanvasElement> elements);
|
|
|
|
private readonly DeleteElements m_DeletionCallback;
|
|
|
|
public DeleteSelected(DeleteElements deletionCallback)
|
|
{
|
|
m_DeletionCallback = deletionCallback;
|
|
}
|
|
|
|
public bool GetCaps(ManipulatorCapability cap)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public void AttachTo(CanvasElement element)
|
|
{
|
|
element.ValidateCommand += Validate;
|
|
element.ExecuteCommand += Delete;
|
|
}
|
|
|
|
private bool Validate(CanvasElement element, Event e, Canvas2D parent)
|
|
{
|
|
if (e.type == EventType.Used)
|
|
return false;
|
|
|
|
if (e.commandName != "Delete" && e.commandName != "SoftDelete")
|
|
return false;
|
|
|
|
e.Use();
|
|
return true;
|
|
}
|
|
|
|
private bool Delete(CanvasElement element, Event e, Canvas2D parent)
|
|
{
|
|
if (e.type == EventType.Used)
|
|
return false;
|
|
|
|
if (e.commandName != "Delete" && e.commandName != "SoftDelete")
|
|
return false;
|
|
|
|
|
|
if (m_DeletionCallback != null)
|
|
{
|
|
m_DeletionCallback(parent.selection);
|
|
parent.ReloadData();
|
|
parent.Repaint();
|
|
}
|
|
e.Use();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
*/
|