Bounce.LevelEditor.Editor.painting_clicked_insert C# (CSharp) Метод

painting_clicked_insert() приватный Метод

private painting_clicked_insert ( MouseEventArgs e ) : void
e MouseEventArgs
Результат void
        private void painting_clicked_insert(MouseEventArgs e)
        {
            DrawPoint mouse = pb_Level.PointToClient(MousePosition);

            // Remove the object under the cursor.
            if (e.Button == MouseButtons.Right)
            {
                foreach (SpaceObject obj in currentlySelectedRoom.Objects.Reverse<SpaceObject>())
                {

                    XnaRectangle bb = obj.getBBRelativeToWorld();

                    /*texture = Image.FromFile(currdir + "\\" + obj.TextureName + ".png");
                    if (mouse.X > obj.Position.X && mouse.X < (obj.Position.X + texture.Width) &&
                        mouse.Y > obj.Position.Y && mouse.Y < (obj.Position.Y + texture.Height))*/
                    if (bb.Contains(Conversion.PointToPoint(mouse)))
                    {
                        currentlySelectedRoom.Objects.Remove(obj);

                        if (obj == currentlySelectedObject)
                        {
                            currentlySelectedObject = null;
                        }
                        break;
                    }
                }
            }

            // Add an object.
            if (e.Button == MouseButtons.Left)
            {
                if (rb_Doors.Checked)
                {
                    makeDoor(mouse);
                }
                else
                {
                    object textureName = lb_TextureList.SelectedItem;

                    if (textureName != null)
                    {
                        texture = Image.FromFile(currdir + "\\" + textureDir + textureName.ToString());

                        MakeSpaceObject(textureDir + textureName.ToString(), texture, mouse);
                    }
                }
            }
        }