Files
CartoonRPG/Library/PackageCache/com.unity.visualeffectgraph@2973a8ac1070/Editor/Manipulators/DownClickable.cs
Caleb Sandford deQuincey 02c4b5ab66 Adding in new packages
2025-06-05 22:59:18 +01:00

37 lines
906 B
C#

using UnityEngine.UIElements;
namespace UnityEditor.VFX.UI
{
class DownClickable : MouseManipulator
{
public event System.Action clicked;
// Click-once type constructor
public DownClickable(System.Action handler)
{
clicked = handler;
activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse });
}
protected override void RegisterCallbacksOnTarget()
{
target.RegisterCallback<MouseDownEvent>(OnMouseDown);
}
protected override void UnregisterCallbacksFromTarget()
{
target.UnregisterCallback<MouseDownEvent>(OnMouseDown);
}
protected void OnMouseDown(MouseDownEvent evt)
{
if (clicked != null)
{
clicked();
evt.StopPropagation();
}
}
}
}