public override void HandleInput()
        {
            InputHelper input = game.inputManager.inputHelper;
            Vector2 pixel = input.MousePosition;
            worldLoc = ProjectionHelper.PixelToFarseer(pixel);

            if (input.IsNewButtonPress(MouseButtons.LeftButton) && !drawing)
            {
                drawing = true;
                worldStart = worldLoc;
                //pixelStart = pixel;
                //d = new DragArea(worldStart, worldStart);
            }
            else if (input.IsOldButtonPress(MouseButtons.LeftButton) && drawing)
            {
                drawing = false;
                DragArea d = new DragArea(worldStart, worldLoc);
                if (d.width > 0 && d.height > 0)
                {

                    Fixture f = CreateFixture(d);

                    FormManager.Property.setPendingObjects(new List<object>() { f.Body });
                    //FormManager.Property.setSelectedObject(f.Body);

                    f.Restitution = .3f;

                    if (input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift))
                    {
                        f.Body.BodyType = BodyType.Dynamic;
                        FarseerTextures.ApplyTexture(f, FarseerTextures.TextureType.Normal);
                    }
                }
            }
        }
        protected override Fixture CreateFixture(DragArea d)
        {
           

            Fixture f = FixtureFactory.AttachRectangle(d.width, d.height, 1, Vector2.Zero, new Body(game.farseerManager.world));
            f.Body.Position = d.center;
            FarseerTextures.ApplyTexture(f, FarseerTextures.TextureType.Normal);
            return f;
        }
        protected override Fixture CreateFixture(DragArea d)
        {


            Fixture f = FixtureFactory.AttachCircle(d.diagonal, 1, new Body(game.farseerManager.world));
            f.Body.Position = worldStart;
            FarseerTextures.ApplyTexture(f, FarseerTextures.TextureType.Normal);

            return f;
        }
        public override void HandleInput()
        {
            InputHelper inputHelper = game.inputManager.inputHelper;

            if (selectingRectangle)
            {
                dragArea = new DragArea(dragStartPixel, inputHelper.MousePosition);
            }

            Mouse();
        }
        private void MouseUp(Vector2 p)
        {

            InputHelper inputHelper = game.inputManager.inputHelper;
            prevWorldLoc = new Vector2();

            dragging = false;

            if (_fixedMouseJoint != null)
            {
                game.farseerManager.world.RemoveJoint(_fixedMouseJoint);
                _fixedMouseJoint = null;
            }

            if (selectingRectangle)
            {
                selectingRectangle = false;
                if (!ProjectionHelper.InsidePixelBounds(inputHelper.MousePosition)) return;
                DragArea d = new DragArea(dragStartWorld, p);
                List<Object> selected = new List<object>();
                foreach (Body b in game.farseerManager.world.BodyList)
                {
                    if (d.ContainsPixel(b.Position))
                        selected.Add(b);
                }

                foreach (Joint j in game.farseerManager.world.JointList)
                {
                    if (d.ContainsPixel(j.WorldAnchorA))
                        selected.Add(j);
                }

                if (selected.Count > 0)
                {
                    FormManager.Property.setPendingObjects(selected);
                    //if (!FormManager.Property.Visible)
                    //    FormManager.Property.Show();

                }
            }
        }
        private void MouseDown(Vector2 p)
        {

            InputHelper inputHelper = game.inputManager.inputHelper;

            if (_fixedMouseJoint != null)
            {
                return;
            }

            savedFixture = game.farseerManager.world.TestPoint(p);

            if (savedFixture != null)
            {
                Body body = savedFixture.Body;
                if (!body.IsStatic)
                {
                    _fixedMouseJoint = new FixedMouseJoint(body, p);
                    _fixedMouseJoint.MaxForce = 1000.0f * body.Mass;
                    game.farseerManager.world.AddJoint(_fixedMouseJoint);
                    body.Awake = true;
                }
                else
                {
                    dragging = true;
                }
            }
            else // start a selection rectangle
            {
                dragStartWorld = p;
                dragStartPixel = inputHelper.MousePosition;
                selectingRectangle = true;
                dragArea = new DragArea(dragStartPixel, dragStartPixel);
            }
        }
 protected abstract Fixture CreateFixture(DragArea d);