You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
865 B
32 lines
865 B
using System;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace UnityEditor.Tilemaps
|
|
{
|
|
internal class TilePaletteContextMenuHandler : MouseManipulator
|
|
{
|
|
private readonly Action m_ContextClick;
|
|
|
|
public TilePaletteContextMenuHandler(Action contextClick)
|
|
{
|
|
m_ContextClick = contextClick;
|
|
activators.Add(new ManipulatorActivationFilter { button = MouseButton.RightMouse });
|
|
}
|
|
|
|
protected override void RegisterCallbacksOnTarget()
|
|
{
|
|
target.RegisterCallback<ContextClickEvent>(OnContextClick);
|
|
}
|
|
|
|
protected override void UnregisterCallbacksFromTarget()
|
|
{
|
|
target.UnregisterCallback<ContextClickEvent>(OnContextClick);
|
|
}
|
|
|
|
private void OnContextClick(ContextClickEvent evt)
|
|
{
|
|
m_ContextClick?.Invoke();
|
|
}
|
|
}
|
|
}
|