Ejemplo n.º 1
0
        //Mouse MOve--------------------------------------------------------------------------------------------------
        private void surfacePictBx_MouseMove(object sender, MouseEventArgs e)
        {
            this.surfacePictBx.Focus();

            Point offSetPoint = this.getOffsetPoint();
            Point pTouched = new Point(Convert.ToInt32(-offSetPoint.X + e.Location.X * (1 / this.CurrentScale)),
                     Convert.ToInt32(-offSetPoint.Y + e.Location.Y * (1 / this.CurrentScale)));

            //Afficher en permanence la position de la souris
            this.mainForm.mouseXPos.Text = "X: " + pTouched.X.ToString();
            this.mainForm.mouseYPos.Text = "Y: " + pTouched.Y.ToString();
            this.mainForm.graduationBarX.reportMouseLocation(pTouched.X);
            this.mainForm.graduationBarY.reportMouseLocation(pTouched.Y);

            currentMousePos = pTouched;

            if (this.movingMode.Equals("FOCUS") && !this.Mode.Equals("CAMERA_RECTANGLE") && this.CurentCalque.Equals("STAGE"))
            {
                Scene sceneSelected = this.mainForm.getElementTreeView().SceneSelected;
                if (sceneSelected != null)
                {
                    if (sceneSelected.Camera.SurfaceFocus.Contains(pTouched))
                    {
                        this.Mode = "MOVE";
                        Cursor = Cursors.SizeAll;
                    }
                    else
                    {
                        this.Mode = "NONE";
                        Cursor = this.openHandCursor;
                    }
                }
                else
                {
                    this.Mode = "NONE";
                    Cursor = this.openHandCursor;
                }

            }

            else if (isMousePressed == false && this.Mode.Equals("CAMERA_RECTANGLE"))
            {
                Cursor = this.createShapeCursor;
            }
            /*else if (isMousePressed == false && this.mainForm.getElementTreeView().JointureSelected != null)
            {
                if (this.indexSceneSelected >= 0)
                {
                    CoronaJointure joint = this.mainForm.getElementTreeView().JointureSelected;
                    if (joint != null)
                    {
                        Point anchorTouched = joint.getAnchorTouched(pTouched);
                        if (anchorTouched != Point.Empty)
                        {
                            Cursor = this.createShapeCursor;
                            this.Mode = "MOVE_JOINT";
                            this.jointAnchorSelected = anchorTouched;
                        }
                        else
                        {
                            this.Mode = "NONE";
                            this.jointAnchorSelected = Point.Empty;
                        }
                    }

                }
            }*/
            else if (isMousePressed == false && !this.Mode.Equals("CREATE_SHAPE") && !this.Mode.Equals("PATH_FOLLOW") && !this.Mode.Equals("JOINT")
                && !this.Mode.Equals("GENERATOR_ATTACH") && !this.movingMode.Equals("AD"))
            {
                string modeTargeted = "NONE";
                if (this.movingMode.Equals("OBJECT"))
                {

                    for (int i = 0; i < this.objectsSelected.Count; i++)
                    {
                        if (this.objectsSelected[i].isEnabled == true)
                        {
                            TransformBox box = this.objectsSelected[i].TransformBox;
                            if (box != null)
                            {
                                modeTargeted = box.getModeFromPointTouched(pTouched);
                                if (!modeTargeted.Equals("NONE"))
                                {
                                    if (modeTargeted.Equals("MOVE_LINE_POINT"))
                                    {
                                        transformBoxSelected = box;
                                    }
                                    else
                                        transformBoxSelected = null;

                                    break;
                                }

                            }
                        }

                    }
                }
                else if (this.movingMode.Equals("ENTITY"))
                {

                    for (int i = 0; i < this.objectsSelected.Count; i++)
                    {
                        if (this.objectsSelected[i].isEnabled == true)
                        {
                            TransformBox box = this.objectsSelected[i].TransformBox;
                            if (box != null)
                            {
                                modeTargeted = box.getModeFromPointTouched(pTouched);
                                if (!modeTargeted.Equals("NONE"))
                                {
                                    transformBoxSelected = box;
                                    break;
                                }

                            }
                        }

                    }
                }
                else if (this.movingMode.Equals("CONTROL"))
                {
                    for (int i = 0; i < this.joysticksSelected.Count; i++)
                    {
                        JoystickControl joy = joysticksSelected[i];
                        if (joy.isEnabled == true)
                        {
                            Rectangle rect = new Rectangle(joy.joystickLocation, new Size(joy.outerRadius * 2, joy.outerRadius * 2));
                            if (rect.Contains(pTouched))
                            {
                                modeTargeted = "MOVE";
                                break;
                            }
                        }

                    }
                }

                if (modeTargeted.Equals("NONE"))
                {
                    if (this.isMousePressed == false)
                        Cursor = this.openHandCursor;

                }
                else if (modeTargeted.Equals("RESIZE_BOTH"))
                {
                    Cursor = Cursors.SizeNWSE;
                }
                else if (modeTargeted.Equals("RESIZE_WIDTH"))
                {
                    Cursor = Cursors.SizeWE;
                }
                else if (modeTargeted.Equals("RESIZE_HEIGHT"))
                {
                    Cursor = Cursors.SizeNS;
                }
                else if (modeTargeted.Equals("MOVE"))
                {
                    Cursor = Cursors.SizeAll;
                }
                else if (modeTargeted.Equals("MOVE_LINE_POINT"))
                {
                    Cursor = this.createShapeCursor;
                }
                else if (modeTargeted.Equals("ROTATION"))
                {
                    Cursor = this.rotationCursor;
                }

                this.Mode = modeTargeted;
            }
            else if ((this.Mode.Equals("CREATE_SHAPE") || this.Mode.Equals("PATH_FOLLOW")) && isMousePressed == false)
            {
                Cursor = this.createShapeCursor;

            }
            else if (this.Mode.Equals("JOINT") && isMousePressed == false)
            {
                CoronaLayer layerSelected = this.mainForm.getElementTreeView().LayerSelected;
                if (layerSelected != null)
                {
                    if (layerSelected.JointureSelected != null && this.mainForm.CurrentJointPanel == null)
                    {
                        if (layerSelected.JointureSelected.isEnabled == true)
                        {
                            Point pTouchedJointure = layerSelected.JointureSelected.getAnchorTouched(pTouched, false);
                            if (pTouchedJointure != Point.Empty)
                            {

                                Cursor = this.createShapeCursor;
                            }
                            else
                                Cursor = this.openHandCursor;
                        }
                    }

                }

            }

            else if (this.movingMode.Equals("AD"))
            {
                if (this.moveSurfaceAdActive == true)
                    Cursor = Cursors.SizeAll;
            }

            if (isMousePressed == true)
            {

                // -----MODE LAYER --------------
                if (CurentCalque.Equals("LAYER"))
                {
                    if (this.Mode.Contains("MOVE") || this.Mode.Contains("RESIZE") || this.Mode.Equals("ROTATION"))
                    {
                        if (!this.movingMode.Equals("CONTROL"))
                        {
                            for (int i = 0; i < this.objectsSelected.Count; i++)
                            {
                                CoronaObject obj = this.objectsSelected[i];
                                DisplayObject dispObject = obj.DisplayObject;
                                if (obj.isEnabled == true)
                                {
                                    if (this.Mode.Equals("MOVE"))
                                    {
                                        if (obj.isEntity == false)
                                            dispObject.move(pTouched);
                                        else
                                        {
                                            for (int j = 0; j < obj.Entity.CoronaObjects.Count; j++)
                                            {
                                                CoronaObject objChild = obj.Entity.CoronaObjects[j];
                                                if (objChild.isEnabled == true)
                                                {
                                                    objChild.DisplayObject.move(pTouched);
                                                }

                                            }
                                        }

                                    }
                                    else if (this.Mode.Equals("MOVE_LINE_POINT"))
                                    {
                                        if (this.transformBoxSelected != null)
                                        {
                                            this.transformBoxSelected.moveLinePoint(pTouched);
                                        }
                                    }
                                    else if (this.Mode.Contains("RESIZE"))
                                    {
                                        if (this.Mode.Equals("RESIZE_WIDTH"))
                                        {
                                            Point finalPoint = new Point(pTouched.X, dispObject.LastPos.Y);
                                            dispObject.setSizeFromPoint(finalPoint);
                                            obj.PhysicsBody.updateBody();
                                        }
                                        else if (this.Mode.Equals("RESIZE_HEIGHT"))
                                        {
                                            Point finalPoint = new Point(dispObject.LastPos.X, pTouched.Y);
                                            dispObject.setSizeFromPoint(finalPoint);
                                            obj.PhysicsBody.updateBody();
                                        }
                                        else if (this.Mode.Equals("RESIZE_BOTH"))
                                        {
                                            dispObject.setSizeFromPoint(pTouched);
                                            obj.PhysicsBody.updateBody();
                                        }

                                        if (dispObject.Type.Equals("IMAGE"))
                                        {
                                            if (dispObject.GorgonSprite != null)
                                            {
                                                float imgScaleX = (float)dispObject.SurfaceRect.Width / (float)dispObject.GorgonSprite.Image.Width;
                                                float imgScaleY = (float)dispObject.SurfaceRect.Height / (float)dispObject.GorgonSprite.Image.Height;

                                                float finalXScale = this.CurrentScale * imgScaleX;
                                                float finalYScale = this.CurrentScale * imgScaleY;
                                                dispObject.GorgonSprite.SetScale(finalXScale, finalYScale);
                                            }

                                        }
                                        else if (dispObject.Type.Equals("FIGURE"))
                                        {
                                            if (dispObject.Figure.ShapeType.Equals("RECTANGLE") || dispObject.Figure.ShapeType.Equals("TEXT"))
                                            {
                                                if (dispObject.GorgonSprite != null)
                                                {
                                                    float imgScaleX = (float)dispObject.SurfaceRect.Width / (float)dispObject.GorgonSprite.Image.Width;
                                                    float imgScaleY = (float)dispObject.SurfaceRect.Height / (float)dispObject.GorgonSprite.Image.Height;

                                                    float finalXScale = this.CurrentScale * imgScaleX;
                                                    float finalYScale = this.CurrentScale * imgScaleY;
                                                    dispObject.GorgonSprite.SetScale(finalXScale, finalYScale);
                                                }
                                            }
                                        }

                                    }
                                    else if (this.Mode.Equals("ROTATION"))
                                    {

                                        int angle = pTouched.X - dispObject.SurfaceRect.X - dispObject.SurfaceRect.Width / 2;
                                        if (angle < -360) angle = -360;
                                        if (angle > 360) angle = 360;
                                        dispObject.Rotation = angle;

                                        if (dispObject.Type.Equals("IMAGE")|| dispObject.Type.Equals("SPRITE"))
                                        {
                                            if (dispObject.GorgonSprite != null)
                                            {
                                                dispObject.GorgonSprite.Rotation = angle;
                                            }

                                        }
                                        else if (dispObject.Type.Equals("FIGURE"))
                                        {
                                            if (dispObject.Figure.ShapeType.Equals("RECTANGLE") || dispObject.Figure.ShapeType.Equals("TEXT"))
                                            {
                                                if (dispObject.GorgonSprite != null)
                                                {
                                                    dispObject.GorgonSprite.Rotation = angle;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < this.joysticksSelected.Count; i++)
                            {
                                JoystickControl joy = this.joysticksSelected[i];
                                if (joy.isEnabled == true)
                                {
                                    int xMove = joy.lastPos.X - pTouched.X;
                                    int yMove = joy.lastPos.Y - pTouched.Y;

                                    joy.joystickLocation = new Point(joy.joystickLocation.X - xMove, joy.joystickLocation.Y - yMove);

                                    joy.lastPos.X = pTouched.X;
                                    joy.lastPos.Y = pTouched.Y;
                                }

                            }
                        }

                        if (this.mainForm.isFormLocked == false)
                            GorgonLibrary.Gorgon.Go();

                        return;
                    }

                    else if (this.Mode.Equals("CREATE_SHAPE"))
                    {
                        if (this.FigActive != null)
                        {
                            //Si un rectangle
                            if (this.mainForm.ShapeType == 1 || this.mainForm.ShapeType == 6)
                            {
                                //Recuperer le carre de la figure active
                                Rect c = this.FigActive as Rect;

                                //Definition de la geometrie du carre
                                if (pTouched.X < pDepart.X && pTouched.Y < pDepart.Y)
                                {
                                    c.Position = pTouched;

                                    c.Width = pDepart.X - pTouched.X;
                                    c.Height = pDepart.Y - pTouched.Y;
                                }

                                else if (pTouched.X > pDepart.X && pTouched.Y > pDepart.Y)
                                {
                                    c.Width = (int)Math.Sqrt(Math.Pow((pTouched.X - pDepart.X), 2));
                                    c.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }
                                else if (e.X < pDepart.X && e.Y > pDepart.Y)
                                {

                                    c.Width = pDepart.X - pTouched.X;
                                    c.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;
                            }

                            //Si un Cercle
                            else if (this.mainForm.ShapeType == 3)
                            {
                                //Recuperer le cercle de la figure active
                                Cercle c = this.FigActive as Cercle;

                                if (c != null)
                                {
                                    //Redefinir la taille du rayon en fonction de la position courante de la souris
                                    c.Rayon = (int)(Math.Sqrt(Math.Pow((pDepart.X - pTouched.X), 2) + Math.Pow((pDepart.Y - pTouched.Y), 2))) / 2;

                                    if (this.mainForm.isFormLocked == false)
                                        GorgonLibrary.Gorgon.Go();

                                }
                                return;
                            }
                            //si un texte
                            else if (this.mainForm.ShapeType == 4 && this.surfaceTextTemp != null)
                            {
                                //Definition de la geometrie du carre
                                if (pTouched.X < pDepart.X && pTouched.Y < pDepart.Y)
                                {
                                    this.surfaceTextTemp.Location = pTouched;

                                    this.surfaceTextTemp.Width = pDepart.X - pTouched.X;
                                    this.surfaceTextTemp.Height = pDepart.Y - pTouched.Y;
                                }

                                else if (pTouched.X > pDepart.X && pTouched.Y > pDepart.Y)
                                {
                                    this.surfaceTextTemp.Width = (int)Math.Sqrt(Math.Pow((pTouched.X - pDepart.X), 2));
                                    this.surfaceTextTemp.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }
                                else if (e.X < pDepart.X && e.Y > pDepart.Y)
                                {

                                    this.surfaceTextTemp.Width = pDepart.X - pTouched.X;
                                    this.surfaceTextTemp.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;
                            }
                        }
                    }
                    else if (this.Mode.Equals("JOINT"))
                    {
                        CoronaLayer layerSelected = this.mainForm.getElementTreeView().LayerSelected;
                        if (layerSelected != null)
                        {
                            if (layerSelected.JointureSelected != null)
                            {
                                if (layerSelected.JointureSelected.isEnabled == true)
                                {
                                    Point pTouchedJointure = layerSelected.JointureSelected.getAnchorTouched(pTouched, true);
                                    if (pTouchedJointure != Point.Empty)
                                    {
                                        if (this.mainForm.isFormLocked == false)
                                            GorgonLibrary.Gorgon.Go();
                                    }
                                    else
                                    {
                                        //Move the camera lcoation
                                        int offSetX = pDepart.X - pTouched.X;
                                        int offSetY = pDepart.Y - pTouched.Y;

                                        Point currentOffset = this.getOffsetPoint();
                                        int Yvalue = -currentOffset.Y + offSetY;
                                        int Xvalue = -currentOffset.X + offSetX;

                                        this.scrollView(Xvalue, Yvalue);

                                        return;
                                    }
                                }
                            }
                        }

                    }
                    else
                    {
                        //Move the camera lcoation

                        int offSetX = pDepart.X - pTouched.X;
                        int offSetY = pDepart.Y - pTouched.Y;

                        Point currentOffset = this.getOffsetPoint();
                        int Yvalue = -currentOffset.Y + offSetY;
                        int Xvalue = -currentOffset.X + offSetX;

                        this.scrollView(Xvalue, Yvalue);
                        return;
                    }

                }
                else if (CurentCalque.Equals("STAGE"))
                {
                    GameElementTreeView treeView = this.mainForm.getElementTreeView();

                    if (this.Mode.Equals("CAMERA_RECTANGLE"))
                    {
                        Scene sceneSelected = treeView.SceneSelected;
                        if (sceneSelected != null)
                        {
                            int width = pTouched.X - pDepart.X;
                            if (width < 10) width = 10;
                            int height = pTouched.Y - pDepart.Y;
                            if (height < 10) height = 10;
                            sceneSelected.Camera.CameraFollowLimitRectangle = new Rectangle(pDepart, new Size(width, height));

                            if (this.mainForm.isFormLocked == false)
                                GorgonLibrary.Gorgon.Go();
                        }
                        return;
                    }
                    else if (this.Mode.Equals("MOVE"))
                    {
                        if (treeView.SceneSelected != null)
                        {
                            if (moveFocusSceneActive == true)
                            {
                                treeView.SceneSelected.Camera.moveFocusScene(pTouched);

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                            }
                            else if (moveObjectActive == true)
                            {
                                for (int i = 0; i < this.objectsSelected.Count; i++)
                                {
                                    if (this.objectsSelected[i].isEnabled == true)
                                    {
                                        if (this.objectsSelected[i].isEntity == false)
                                        {
                                            this.objectsSelected[i].DisplayObject.move(pTouched);
                                        }
                                        else
                                        {
                                            for (int j = 0; j < this.objectsSelected[i].Entity.CoronaObjects.Count; j++)
                                            {
                                                CoronaObject child = this.objectsSelected[i].Entity.CoronaObjects[j];
                                                if (child.isEnabled == true)
                                                {
                                                    child.DisplayObject.move(pTouched);
                                                }
                                            }
                                        }
                                    }

                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                            }
                            else if (moveSurfaceAdActive == true)
                            {
                                treeView.SceneSelected.moveAdSurface(pTouched);

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                            }
                            else if (moveSurfaceControlActive == true)
                            {
                                for (int i = 0; i < this.joysticksSelected.Count; i++)
                                {
                                    JoystickControl joy = this.joysticksSelected[i];
                                    if (joy.isEnabled == true)
                                    {
                                        int xMove = joy.lastPos.X - pTouched.X;
                                        int yMove = joy.lastPos.Y - pTouched.Y;

                                        joy.joystickLocation = new Point(joy.joystickLocation.X - xMove, joy.joystickLocation.Y - yMove);

                                        joy.lastPos.X = pTouched.X;
                                        joy.lastPos.Y = pTouched.Y;
                                    }
                                }

                                GorgonLibrary.Gorgon.Go();
                            }
                        }
                    }
                    else if (this.Mode.Equals("MOVE_LINE_POINT"))
                    {
                        if (this.transformBoxSelected != null)
                        {
                            this.transformBoxSelected.moveLinePoint(pTouched);

                            if (this.mainForm.isFormLocked == false)
                                GorgonLibrary.Gorgon.Go();
                        }
                    }
                    else if (this.Mode.Contains("RESIZE"))
                    {
                        if (moveObjectActive == true)
                        {
                            if (this.Mode.Equals("RESIZE_WIDTH"))
                            {
                                for (int i = 0; i < this.objectsSelected.Count; i++)
                                {
                                    CoronaObject obj = this.objectsSelected[i];
                                    if (obj.isEnabled == true)
                                    {
                                        Point finalPoint = new Point(pTouched.X, obj.DisplayObject.LastPos.Y);
                                        obj.DisplayObject.setSizeFromPoint(finalPoint);

                                        obj.PhysicsBody.updateBody();
                                    }
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();

                                return;

                            }
                            else if (this.Mode.Equals("RESIZE_HEIGHT"))
                            {
                                for (int i = 0; i < this.objectsSelected.Count; i++)
                                {
                                    CoronaObject obj = this.objectsSelected[i];
                                    if (obj.isEnabled == true)
                                    {
                                        Point finalPoint = new Point(obj.DisplayObject.LastPos.X, pTouched.Y);
                                        obj.DisplayObject.setSizeFromPoint(finalPoint);

                                        obj.PhysicsBody.updateBody();
                                    }
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;

                            }
                            else if (this.Mode.Equals("RESIZE_BOTH"))
                            {
                                for (int i = 0; i < this.objectsSelected.Count; i++)
                                {
                                    CoronaObject obj = this.objectsSelected[i];
                                    if (obj.isEnabled == true)
                                    {
                                        obj.DisplayObject.setSizeFromPoint(pTouched);

                                        obj.PhysicsBody.updateBody();
                                    }
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;
                            }

                        }
                    }
                    else if (this.Mode.Equals("ROTATION"))
                    {
                        if (moveObjectActive == true)
                        {
                            for (int i = 0; i < this.objectsSelected.Count; i++)
                            {
                                CoronaObject obj = this.objectsSelected[i];
                                if (obj.isEnabled == true)
                                {
                                    int angle = pTouched.X - obj.DisplayObject.SurfaceRect.X - obj.DisplayObject.SurfaceRect.Width / 2;
                                    if (angle < -360) angle = -360;
                                    if (angle > 360) angle = 360;
                                    obj.DisplayObject.Rotation = angle;
                                }
                            }

                            if (this.mainForm.isFormLocked == false)
                                GorgonLibrary.Gorgon.Go();
                        }

                    }
                    else if (this.Mode.Equals("CREATE_SHAPE"))
                    {
                        if (this.FigActive != null)
                        {
                            //Si un rectangle
                            if (this.mainForm.ShapeType == 1 || this.mainForm.ShapeType == 6)
                            {
                                //Recuperer le carre de la figure active
                                Rect c = this.FigActive as Rect;

                                //Definition de la geometrie du carre
                                if (pTouched.X < pDepart.X && pTouched.Y < pDepart.Y)
                                {
                                    c.Position = pTouched;

                                    c.Width = pDepart.X - pTouched.X;
                                    c.Height = pDepart.Y - pTouched.Y;
                                }

                                else if (pTouched.X > pDepart.X && pTouched.Y > pDepart.Y)
                                {
                                    c.Width = (int)Math.Sqrt(Math.Pow((pTouched.X - pDepart.X), 2));
                                    c.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }
                                else if (e.X < pDepart.X && e.Y > pDepart.Y)
                                {

                                    c.Width = pDepart.X - pTouched.X;
                                    c.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;
                            }

                            //Si un Cercle
                            else if (this.mainForm.ShapeType == 3)
                            {
                                //Recuperer le cercle de la figure active
                                Cercle c = this.FigActive as Cercle;

                                if (c != null)
                                {
                                    //Redefinir la taille du rayon en fonction de la position courante de la souris
                                    c.Rayon = (int)(Math.Sqrt(Math.Pow((pDepart.X - pTouched.X), 2) + Math.Pow((pDepart.Y - pTouched.Y), 2))) / 2;

                                    if (this.mainForm.isFormLocked == false)
                                        GorgonLibrary.Gorgon.Go();

                                }
                                return;
                            }
                            //si un texte
                            else if (this.mainForm.ShapeType == 4 && this.surfaceTextTemp != null)
                            {
                                //Definition de la geometrie du carre
                                if (pTouched.X < pDepart.X && pTouched.Y < pDepart.Y)
                                {
                                    this.surfaceTextTemp.Location = pTouched;

                                    this.surfaceTextTemp.Width = pDepart.X - pTouched.X;
                                    this.surfaceTextTemp.Height = pDepart.Y - pTouched.Y;
                                }

                                else if (pTouched.X > pDepart.X && pTouched.Y > pDepart.Y)
                                {
                                    this.surfaceTextTemp.Width = (int)Math.Sqrt(Math.Pow((pTouched.X - pDepart.X), 2));
                                    this.surfaceTextTemp.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }
                                else if (e.X < pDepart.X && e.Y > pDepart.Y)
                                {

                                    this.surfaceTextTemp.Width = pDepart.X - pTouched.X;
                                    this.surfaceTextTemp.Height = (int)Math.Sqrt(Math.Pow((pTouched.Y - pDepart.Y), 2));
                                }

                                if (this.mainForm.isFormLocked == false)
                                    GorgonLibrary.Gorgon.Go();
                                return;
                            }
                        }
                    }
                    else if (this.Mode.Equals("MOVE_JOINT"))
                    {
                        if (this.jointAnchorSelected != Point.Empty)
                        {
                            this.jointAnchorSelected.X = pTouched.X;
                            this.jointAnchorSelected.Y = pTouched.Y;
                        }
                    }

                    else
                    {

                        //Move the camera lcoation
                        int offSetX = pDepart.X - pTouched.X;
                        int offSetY = pDepart.Y - pTouched.Y;

                        Point currentOffset = this.getOffsetPoint();
                        int Yvalue = -currentOffset.Y + offSetY;
                        int Xvalue = -currentOffset.X + offSetX;

                        this.scrollView(Xvalue, Yvalue);
                        return;
                    }

                }
            }
        }
Ejemplo n.º 2
0
 public void setSelected(bool isSelected)
 {
     this.isSelected = isSelected;
     if(isSelected == true)
          this.TransformBox = new TransformBox(this);
     else
         this.TransformBox = null;
 }