Beispiel #1
0
        public void Handle_RubberBandSelection(RubberBandSelectionEventArgs e)
        {
            if (e != null)
            {
                if (e.Select == MouseSelection.CancelSelection)
                {
                    return;
                }

                // Clear existing selection since multiselection with addition is not what we want
                if (e.Select == MouseSelection.ReducedToNewSelection)
                {
                    this.SelectedItem.Clear();
                }

                Rect rubberBand = new Rect(e.StartPoint, e.EndPoint);

                foreach (var item in this.DocumentViewModel.dm_DocumentDataModel.DocRoot.OfType <ShapeSizeViewModelBase>())
                {
                    Rect itemBounds = new Rect(item.Position, item.EndPosition);

                    bool contains = rubberBand.Contains(itemBounds);

                    if (contains == true)
                    {
                        this.SelectedItem.Add(item);
                    }
                }
            }
        }
Beispiel #2
0
        private void handler_RubberBandSelection(object sender, RubberBandSelectionEventArgs e)
        {
            if (this.mCurrentMouseHandler is CreateRubberBandMouseHandler handler)
            {
                handler.RubberBandSelection -= this.handler_RubberBandSelection;
            }

            this.CanvasViewModel.Handle_RubberBandSelection(e);

            this.EndMouseOperation();
            this.DestroyRubberband();
        }