RectangleZoom.cs 678 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. namespace UnityEditor.Timeline
  3. {
  4. class RectangleZoom : RectangleTool
  5. {
  6. protected override bool enableAutoPan { get { return true; } }
  7. protected override bool CanStartRectangle(Event evt, Vector2 mousePosition, WindowState state)
  8. {
  9. return evt.button == 1 && evt.modifiers == (EventModifiers.Alt | EventModifiers.Shift);
  10. }
  11. protected override bool OnFinish(Event evt, WindowState state, Rect rect)
  12. {
  13. var x = state.PixelToTime(rect.xMin);
  14. var y = state.PixelToTime(rect.xMax);
  15. state.SetTimeAreaShownRange(x, y);
  16. return true;
  17. }
  18. }
  19. }