Пример #1
0
        /// <summary>
        /// Called each frame.
        /// </summary>
        public void Step()
        {
            if (_moveController != null)
            {
                _moveController.Move();
            }

            OnStep();
        }
Пример #2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.None)
            {
                this.Cursor = Cursors.Arrow;
                Point mousePoint = Gsc2Goc(new Point(e.X, e.Y));

                if ((resizeAction != null) &&
                    ((document.Action == DesignerAction.Select) ||
                     ((document.Action == DesignerAction.Connect) &&
                      (resizeAction.IsResizingLink))))
                {
                    this.Cursor = resizeAction.UpdateResizeCornerCursor(mousePoint);
                }

                if (document.Action == DesignerAction.Connect)
                {
                    BaseElement mousePointerElementTMP = document.FindElement(mousePoint);
                    if (mousePointerElement != mousePointerElementTMP)
                    {
                        if (mousePointerElementTMP is ConnectorElement)
                        {
                            mousePointerElement = mousePointerElementTMP;
                            mousePointerElement.Invalidate();
                            this.Invalidate(mousePointerElement, true);
                        }
                        else if (mousePointerElement != null)
                        {
                            mousePointerElement.Invalidate();
                            this.Invalidate(mousePointerElement, true);
                            mousePointerElement = null;
                        }
                    }
                }
                else
                {
                    this.Invalidate(mousePointerElement, true);
                    mousePointerElement = null;
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                Point dragPoint = Gsc2Goc(new Point(e.X, e.Y));

                if ((resizeAction != null) && (resizeAction.IsResizing))
                {
                    resizeAction.Resize(dragPoint);
                    this.Invalidate();
                }

                if ((moveAction != null) && (moveAction.IsMoving))
                {
                    moveAction.Move(dragPoint);
                    this.Invalidate();
                }

                if ((isMultiSelection) || (isAddSelection))
                {
                    Point p = Gsc2Goc(new Point(e.X, e.Y));
                    selectionArea.Size = new Size(p.X - selectionArea.Location.X, p.Y - selectionArea.Location.Y);
                    selectionArea.Invalidate();
                    this.Invalidate(selectionArea, true);
                }

                if (isAddLink)
                {
                    selectedElement = document.FindElement(dragPoint);
                    if ((selectedElement is ConnectorElement) &&
                        (document.CanAddLink(connStart, (ConnectorElement)selectedElement)))
                    {
                        linkLine.Connector2 = (ConnectorElement)selectedElement;
                    }
                    else
                    {
                        linkLine.Connector2 = connEnd;
                    }

                    IMoveController ctrl = (IMoveController)((IControllable)connEnd).GetController();
                    ctrl.Move(dragPoint);

                    //this.Invalidate(linkLine, true); //TODO
                    base.Invalidate();
                }
            }

            base.OnMouseMove(e);
        }