Library/PackageCache/com.unity.quicksearch@1.6.0-preview.8/Editor/QuickSearch.cs
/// <summary>
/// Add items to the current selection.
/// </summary>
/// <param name="selection">List containing indices of items to add to current selection.</param>
Add items to the current selection.
Add items to the current selection .
public void AddSelection(params int[] selection)
        {
            if (!multiselect && m_Selection.Count == 1)
                throw new Exception("Multi selection is not allowed.");
            var lastIndexAdded = k_ResetSelectionIndex;
            if (!(Event.current.keyCode == KeyCode.DownArrow || Event.current.keyCode == KeyCode.UpArrow))
            {
                if (m_Selection.Count > 1)
                {
                    m_Selection.RemoveRange(1, m_Selection.Count - 1);
                }
            }
            foreach (var idx in selection)
            {
                if (!IsItemValid(idx))
                    continue;
                if (m_Selection.Contains(idx))
                {
                    m_Selection.Remove(idx);
                }
                else
                {
                    m_Selection.Add(idx);
                    lastIndexAdded = idx;
                }
            }
            if (lastIndexAdded != k_ResetSelectionIndex)
                TrackSelection(lastIndexAdded);
        }
public void AddSelection ( params int [ ] selection ) { if ( ! multiselect && m_Selection . Count == 1 ) throw new Exception ( " " ) ; var lastIndexAdded = k_ResetSelectionIndex ; if ( ! ( Event . current . keyCode == KeyCode . DownArrow || Event . current . keyCode == KeyCode . UpArrow ) ) { if ( m_Selection . Count > 1 ) { m_Selection . RemoveRange ( 1 , m_Selection . Count - 1 ) ; } } foreach ( var idx in selection ) { if ( ! IsItemValid ( idx ) ) continue ; if ( m_Selection . Contains ( idx ) ) { m_Selection . Remove ( idx ) ; } else { m_Selection . Add ( idx ) ; lastIndexAdded = idx ; } } if ( lastIndexAdded != k_ResetSelectionIndex ) TrackSelection ( lastIndexAdded ) ; }
Add items to the current selection.
Add items to the current selection .
selection
List containing indices of items to add to current selection.
List containing indices of items to add to current selection .