SuperCollapser.cs 886 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using UnityEditor.Experimental.GraphView;
  6. using UnityEngine;
  7. using UnityEngine.UIElements;
  8. namespace UnityEditor.VFX.UI
  9. {
  10. class SuperCollapser : Manipulator
  11. {
  12. public SuperCollapser()
  13. {
  14. }
  15. protected override void RegisterCallbacksOnTarget()
  16. {
  17. target.RegisterCallback<MouseDownEvent>(OnMouseUp);
  18. }
  19. protected override void UnregisterCallbacksFromTarget()
  20. {
  21. target.UnregisterCallback<MouseDownEvent>(OnMouseUp);
  22. }
  23. void OnMouseUp(MouseDownEvent e)
  24. {
  25. if (e.clickCount == 2)
  26. {
  27. VFXNodeUI slotContainer = (VFXNodeUI)target;
  28. slotContainer.controller.superCollapsed = !slotContainer.superCollapsed;
  29. }
  30. }
  31. }
  32. }