예제 #1
0
        protected virtual void HandlePick(MouseEventArgs e)
        {
            SelectMode        selectMode = InputScheme.GetSelectMode(Control.ModifierKeys);
            ISelectionContext selection  = DesignView.Context.As <ISelectionContext>();
            var  hits        = Pick(e);
            bool multiSelect = DragOverThreshold;

            if (multiSelect == false && hits.Any())
            {
                List <object> singleHit = new List <object>();
                if (selectMode == SelectMode.Normal)
                {
                    m_hitIndex++;
                    if (m_hitIndex >= hits.Count())
                    {
                        m_hitIndex = 0;
                    }
                    singleHit.Add(hits.ElementAt(m_hitIndex));
                }
                else
                {
                    singleHit.Add(hits.ElementAt(0));
                }
                hits = singleHit;
            }

            switch (selectMode)
            {
            case SelectMode.Normal:
                selection.SetRange(hits);
                break;

            case SelectMode.Extend:
                selection.AddRange(hits);
                break;

            case SelectMode.Toggle:
                selection.ToggleRange(hits);
                break;

            case SelectMode.Remove:
                selection.RemoveRange(hits);
                break;

            default:
                break;
            }
        }