SourceGrid.GridVirtual.CheckPositions C# (CSharp) Method

CheckPositions() public method

Check if the positions saved are still valid, for example if all the selected cells are still valid positions, if not the selection are removed without calling any other methods.
public CheckPositions ( ) : void
return void
        public virtual void CheckPositions()
        {
            Range complete = CompleteRange;

            if (m_MouseCellPosition.IsEmpty() == false &&
                CompleteRange.Contains(m_MouseCellPosition) == false)
                m_MouseCellPosition = Position.Empty;

            if (m_MouseDownPosition.IsEmpty() == false &&
                CompleteRange.Contains(m_MouseDownPosition) == false)
                m_MouseDownPosition = Position.Empty;

            if (mDragCellPosition.IsEmpty() == false &&
                CompleteRange.Contains(mDragCellPosition) == false)
                mDragCellPosition = Position.Empty;

            //If the selection contains some invalid cells reset the selection state.
            RangeRegion completeRegion = new RangeRegion(complete);
            if (
                (Selection.ActivePosition.IsEmpty() == false && complete.Contains(Selection.ActivePosition) == false) ||
                (Selection.IsEmpty() == false && completeRegion.Contains(Selection.GetSelectionRegion()) == false)
                )
                Selection.ResetSelection(false);
        }