예제 #1
0
 public new void MouseDown(IViewportController viewportController, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         this.mouseDownPosition = viewportController.MouseToGrid(e.X, e.Y);
     }
 }
예제 #2
0
        public new void MouseMove(IViewportController viewportController, int dx, int dy, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Vector3 mouseUpPosition = viewportController.MouseToGrid(e.X, e.Y);
                Vector3 movement = mouseUpPosition - mouseDownPosition;

                foreach (EditNode editNode in Editor.SelectedNodes)
                    editNode.Position += movement;

                this.mouseDownPosition = mouseUpPosition;
            }
        }
예제 #3
0
        public new void MouseDown(IViewportController viewportController, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Vector3 position = viewportController.MouseToGrid(e.X, e.Y);

                if (this.lstEntityTypes.SelectedItem != null)
                {
                    string key = this.lstEntityTypes.SelectedItem.ToString();

                    Editor.CreateEditNode(key, position);
                }
            }
        }
예제 #4
0
        public new void MouseDown(IViewportController viewportController, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Vector3 position = viewportController.MouseToGrid(e.X, e.Y);

                if (this.lstEntityTypes.SelectedItem != null)
                {
                    string key = this.lstEntityTypes.SelectedItem.ToString();

                    Editor.CreateEditNode(key, position);
                }
            }
        }
예제 #5
0
        public new void MouseMove(IViewportController viewportController, int dx, int dy, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Vector3 mouseUpPosition = viewportController.MouseToGrid(e.X, e.Y);
                Vector3 movement        = mouseUpPosition - mouseDownPosition;

                foreach (EditNode editNode in Editor.SelectedNodes)
                {
                    editNode.Position += movement;
                }

                this.mouseDownPosition = mouseUpPosition;
            }
        }
예제 #6
0
        public bool MouseMove(IViewportController viewportController, System.Windows.Forms.MouseEventArgs e)
        {
            if (this.isCreated)
            {
                // update the visual feedback if we are not doing anything else
                if (this.selectedGrip == ResizableBox.MG_NONE)
                {
                    GetSelectedGrip(viewportController, e.X, e.Y);
                }

                if (e.Button == MouseButtons.Left)
                {
                    Vector3 mousePos = viewportController.MouseToGrid(e.X, e.Y);

                    switch (this.selectedGrip)
                    {
                    case ResizableBox.MG_NONE:          // creating a new box
                        this.max = mousePos;
                        break;

                    case ResizableBox.MG_MOVE:          // moving a box
                        Vector3 movement = mousePos - this.mouseDownPos;
                        this.min         += movement;
                        this.max         += movement;
                        this.mouseDownPos = mousePos;
                        break;

                    default:
                        this.Resize(mousePos, viewportController.Viewport.VisibilityMask);
                        break;
                    }

                    this.Update();
                }
            }
            else
            {
                if (e.Button == MouseButtons.Left && this.selectedGrip == ResizableBox.MG_NONE)
                {
                    this.Create();
                }
            }

            return(this.selectedGrip != ResizableBox.MG_NONE);
        }
예제 #7
0
        public bool MouseUp(IViewportController viewportController, MouseEventArgs e)
        {
            bool returnValue = this.selectedGrip != ResizableBox.MG_NONE;

            if (e.Button == MouseButtons.Left)
            {
                if (this.selectedGrip == ResizableBox.MG_NONE)
                {
                    // finish creating a new box
                    this.max = viewportController.MouseToGrid(e.X, e.Y);
                }

                if (min == max)
                {
                    this.Destroy();
                }

                if (min.x == max.x)
                {
                    min.x = max.x + 1;
                }

                if (min.y == max.y)
                {
                    min.y = max.y + 1;
                }

                if (min.z == max.z)
                {
                    min.z = max.z + 1;
                }

                // make sure min an max are around the right way
                Vector3 temp = Editor.MinOf(min, max);
                this.max = Editor.MaxOf(min, max);
                this.min = temp;

                this.Update();
                this.selectedGrip = ResizableBox.MG_NONE;
            }

            return(returnValue);
        }
예제 #8
0
        public bool MouseDown(IViewportController viewportController, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.mouseDownPos = viewportController.MouseToGrid(e.X, e.Y);
                this.selectedGrip = this.GetSelectedGrip(viewportController, e.X, e.Y);

                // create a new box
                if (this.selectedGrip == ResizableBox.MG_NONE)
                {
                    this.selectedObject = null;
                    this.min            = mouseDownPos;
                    this.max            = mouseDownPos;

                    if (this.isCreated)
                    {
                        this.Destroy();
                    }
                }
            }

            return(this.selectedGrip != ResizableBox.MG_NONE);
        }
예제 #9
0
        public bool MouseDown(IViewportController viewportController, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                this.mouseDownPos = viewportController.MouseToGrid(e.X, e.Y);
                this.selectedGrip = this.GetSelectedGrip(viewportController, e.X, e.Y);

                // create a new box
                if (this.selectedGrip == ResizableBox.MG_NONE)
                {
                    this.selectedObject = null;
                    this.min = mouseDownPos;
                    this.max = mouseDownPos;

                    if (this.isCreated)
                        this.Destroy();
                }
            }

            return this.selectedGrip != ResizableBox.MG_NONE;
        }
예제 #10
0
        public bool MouseUp(IViewportController viewportController, MouseEventArgs e)
        {
            bool returnValue = this.selectedGrip != ResizableBox.MG_NONE;

            if (e.Button == MouseButtons.Left)
            {
                if(this.selectedGrip == ResizableBox.MG_NONE)
                {
                    // finish creating a new box
                    this.max = viewportController.MouseToGrid(e.X, e.Y);
                }

                if (min == max)
                    this.Destroy();

                if (min.x == max.x)
                    min.x = max.x + 1;

                if (min.y == max.y)
                    min.y = max.y + 1;

                if (min.z == max.z)
                    min.z = max.z + 1;

                // make sure min an max are around the right way
                Vector3 temp = Editor.MinOf(min, max);
                this.max = Editor.MaxOf(min, max);
                this.min = temp;

                this.Update();
                this.selectedGrip = ResizableBox.MG_NONE;
            }

            return returnValue;
        }
예제 #11
0
        public bool MouseMove(IViewportController viewportController, System.Windows.Forms.MouseEventArgs e)
        {
            if (this.isCreated)
            {
                // update the visual feedback if we are not doing anything else
                if (this.selectedGrip == ResizableBox.MG_NONE)
                    GetSelectedGrip(viewportController, e.X, e.Y);

                if (e.Button == MouseButtons.Left)
                {
                    Vector3 mousePos = viewportController.MouseToGrid(e.X, e.Y);

                    switch (this.selectedGrip)
                    {
                        case ResizableBox.MG_NONE:      // creating a new box
                            this.max = mousePos;
                            break;
                        case ResizableBox.MG_MOVE:      // moving a box
                            Vector3 movement = mousePos - this.mouseDownPos;
                            this.min += movement;
                            this.max += movement;
                            this.mouseDownPos = mousePos;
                            break;
                        default:
                            this.Resize(mousePos, viewportController.Viewport.VisibilityMask);
                            break;
                    }

                    this.Update();
                }
            }
            else
            {
                if (e.Button == MouseButtons.Left && this.selectedGrip == ResizableBox.MG_NONE)
                    this.Create();
            }

            return this.selectedGrip != ResizableBox.MG_NONE;
        }
예제 #12
0
 public new void MouseDown(IViewportController viewportController, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
         this.mouseDownPosition = viewportController.MouseToGrid(e.X, e.Y);
 }