暫無描述
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.

HeaderSplitterManipulator.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using UnityEngine;
  3. namespace UnityEditor.Timeline
  4. {
  5. class HeaderSplitterManipulator : Manipulator
  6. {
  7. bool m_Captured;
  8. protected override bool MouseDown(Event evt, WindowState state)
  9. {
  10. Rect headerSplitterRect = state.GetWindow().headerSplitterRect;
  11. if (headerSplitterRect.Contains(evt.mousePosition))
  12. {
  13. m_Captured = true;
  14. state.AddCaptured(this);
  15. return true;
  16. }
  17. return false;
  18. }
  19. protected override bool MouseDrag(Event evt, WindowState state)
  20. {
  21. if (!m_Captured)
  22. return false;
  23. state.sequencerHeaderWidth = evt.mousePosition.x;
  24. return true;
  25. }
  26. protected override bool MouseUp(Event evt, WindowState state)
  27. {
  28. if (!m_Captured)
  29. return false;
  30. state.RemoveCaptured(this);
  31. m_Captured = false;
  32. return true;
  33. }
  34. public override void Overlay(Event evt, WindowState state)
  35. {
  36. Rect rect = state.GetWindow().sequenceRect;
  37. EditorGUIUtility.AddCursorRect(rect, MouseCursor.SplitResizeLeftRight);
  38. }
  39. }
  40. }