TrackResizeHandle.cs 965 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. namespace UnityEditor.Timeline
  3. {
  4. class TrackResizeHandle : IBounds
  5. {
  6. public Rect boundingRect { get; private set; }
  7. public TimelineTrackGUI trackGUI { get; }
  8. public TrackResizeHandle(TimelineTrackGUI trackGUI)
  9. {
  10. this.trackGUI = trackGUI;
  11. }
  12. public void Draw(Rect headerRect, WindowState state)
  13. {
  14. const float resizeHandleHeight = WindowConstants.trackResizeHandleHeight;
  15. var rect = new Rect(headerRect.xMin, headerRect.yMax - (0.5f * resizeHandleHeight), headerRect.width, resizeHandleHeight);
  16. boundingRect = trackGUI.ToWindowSpace(rect);
  17. var cursorRect = rect;
  18. cursorRect.height--;
  19. EditorGUIUtility.AddCursorRect(cursorRect, MouseCursor.SplitResizeUpDown);
  20. if (Event.current.type == EventType.Repaint)
  21. state.headerSpacePartitioner.AddBounds(this);
  22. }
  23. }
  24. }