No Description
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.

TilePaletteContextMenuHandler.cs 865B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEngine.UIElements;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. internal class TilePaletteContextMenuHandler : MouseManipulator
  6. {
  7. private readonly Action m_ContextClick;
  8. public TilePaletteContextMenuHandler(Action contextClick)
  9. {
  10. m_ContextClick = contextClick;
  11. activators.Add(new ManipulatorActivationFilter { button = MouseButton.RightMouse });
  12. }
  13. protected override void RegisterCallbacksOnTarget()
  14. {
  15. target.RegisterCallback<ContextClickEvent>(OnContextClick);
  16. }
  17. protected override void UnregisterCallbacksFromTarget()
  18. {
  19. target.UnregisterCallback<ContextClickEvent>(OnContextClick);
  20. }
  21. private void OnContextClick(ContextClickEvent evt)
  22. {
  23. m_ContextClick?.Invoke();
  24. }
  25. }
  26. }