File size: 1,477 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | using UnityEngine;
namespace UnityEditor.Timeline
{
class TimelineClipHandle : ILayerable
{
Rect m_Rect;
readonly TimelineClipGUI m_ClipGUI;
readonly TrimEdge m_TrimDirection;
readonly LayerZOrder m_ZOrder;
public Rect boundingRect
{
get { return m_ClipGUI.parent.ToWindowSpace(m_Rect); }
}
public TrimEdge trimDirection
{
get { return m_TrimDirection; }
}
public TimelineClipGUI clipGUI
{
get { return m_ClipGUI; }
}
public LayerZOrder zOrder
{
get { return m_ZOrder; }
}
public TimelineClipHandle(TimelineClipGUI theClipGUI, TrimEdge trimDirection)
{
m_TrimDirection = trimDirection;
m_ClipGUI = theClipGUI;
m_ZOrder = theClipGUI.zOrder.ChangeLayer(Layer.ClipHandles);
}
public void Draw(Rect clientRect, float width, WindowState state)
{
var handleRect = clientRect;
handleRect.width = width;
if (m_TrimDirection == TrimEdge.End)
handleRect.x = clientRect.xMax - width;
m_Rect = handleRect;
if (!TimelineWindow.instance.state.editSequence.isReadOnly)
EditorGUIUtility.AddCursorRect(handleRect, MouseCursor.SplitResizeLeftRight);
state.spacePartitioner.AddBounds(this, boundingRect);
}
}
}
|