RectangleSelect.cs 1008 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Linq;
  2. using UnityEngine;
  3. namespace UnityEditor.Timeline
  4. {
  5. class RectangleSelect : RectangleTool
  6. {
  7. protected override bool enableAutoPan { get { return false; } }
  8. protected override bool CanStartRectangle(Event evt, Vector2 mousePosition, WindowState state)
  9. {
  10. if (evt.button != 0 || evt.alt)
  11. return false;
  12. return PickerUtils.pickedElements.All(e => e is IRowGUI);
  13. }
  14. protected override bool OnFinish(Event evt, WindowState state, Rect rect)
  15. {
  16. var selectables = state.spacePartitioner.GetItemsInArea<ISelectable>(rect).ToList();
  17. if (!selectables.Any())
  18. return false;
  19. if (ItemSelection.CanClearSelection(evt))
  20. SelectionManager.Clear();
  21. foreach (var selectable in selectables)
  22. {
  23. ItemSelection.HandleItemSelection(evt, selectable);
  24. }
  25. return true;
  26. }
  27. }
  28. }