Exemplo n.º 1
0
        protected void OnMouseUp_Picking(MouseButtonEventArgs e)
        {
            List <int> added   = new List <int>();
            List <int> removed = new List <int>();

            if (buttonPressed)
            {
                IList <devDept.Eyeshot.Entities.Entity> myEnts = Entities.CurrentBlockReference != null
                    ? Blocks[Entities.CurrentBlockReference.BlockName].Entities
                    : new List <devDept.Eyeshot.Entities.Entity>(Entities);

                buttonPressed = false;
                int   ent;
                int[] ents;

                if (Keyboard.Modifiers != ModifierKeys.Control)
                {
                    for (int i = 0; i < myEnts.Count; i++)
                    {
                        if (myEnts[i].Selected)
                        {
                            removed.Add(i);
                        }

                        myEnts[i].Selected = false;
                    }
                }

                int dx = currentLocation.X - initialLocation.X;
                int dy = currentLocation.Y - initialLocation.Y;

                System.Drawing.Point p1 = initialLocation;
                System.Drawing.Point p2 = currentLocation;

                NormalizeBox(ref p1, ref p2);

                switch (CurrentPickState)
                {
                case Common.ViewportPickState.Pick:

                    ent = GetEntityUnderMouseCursor(currentLocation);

                    if (ent >= 0)
                    {
                        ManageSelection(ent, myEnts, added, removed);
                    }

                    break;

                case Common.ViewportPickState.Crossing:

                    if (dx != 0 && dy != 0)
                    {
                        ents =
                            GetAllCrossingEntities(new System.Drawing.Rectangle(p1,
                                                                                new System.Drawing.Size(Math.Abs(dx), Math.Abs(dy))));

                        for (int i = 0; i < ents.Length; i++)
                        {
                            ManageSelection(ents[i], myEnts, added, removed);
                        }
                    }

                    break;

                case Common.ViewportPickState.Enclosed:

                    if (dx != 0 && dy != 0)
                    {
                        ents =
                            GetAllEnclosedEntities(new System.Drawing.Rectangle(p1,
                                                                                new System.Drawing.Size(Math.Abs(dx), Math.Abs(dy))));

                        for (int i = 0; i < ents.Length; i++)
                        {
                            ManageSelection(ents[i], myEnts, added, removed);
                        }
                    }
                    break;
                }
                Entities.Regen();
                Invalidate();
            }

            CustomSelectionChanged?.Invoke(this, new SelectionChangedEventArgs(added.ToArray(), removed.ToArray(), this));
        }
Exemplo n.º 2
0
 public override void Selected(UIPickerView pickerView, nint row, nint component)
 {
     CustomSelectionChanged?.Invoke(this, (int)row);
 }