summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Sequence/RectangleZoom.cs
blob: 0a2d45f994f4e84f0991a51844e134297bfc96cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using UnityEngine;

namespace UnityEditor.Timeline
{
    class RectangleZoom : RectangleTool
    {
        protected override bool enableAutoPan { get { return true; } }

        protected override bool CanStartRectangle(Event evt, Vector2 mousePosition, WindowState state)
        {
            return evt.button == 1 && evt.modifiers == (EventModifiers.Alt | EventModifiers.Shift);
        }

        protected override bool OnFinish(Event evt, WindowState state, Rect rect)
        {
            var x = state.PixelToTime(rect.xMin);
            var y = state.PixelToTime(rect.xMax);
            state.SetTimeAreaShownRange(x, y);

            return true;
        }
    }
}