示例#1
0
文件: MoveState.cs 项目: microm/eplib
        public override void OnMouseEvent(MouseEvent mouseEvent)
        {
            TPoint currentOffset = mouseEvent.Info.position - mouseEvent.PreviousPosition;

            switch ( mouseEvent.State )
            {
                case MouseEvent.EventState.Move:
                    {
                        Move(currentOffset, m_controls);
                        m_offset += currentOffset;
                    }
                    break;
                case MouseEvent.EventState.LUp:
                    {
                        Move(-m_offset,m_controls);
                        m_offset += currentOffset;
                        ICommand command = new MoveControl(m_controls, m_offset);
                        m_commandManager.CurrentCommand = command;
                        m_commandManager.Execute();

                        m_stateManager.ChangeState( StateType.Idle );
                    }
                    break;
            }
        }
示例#2
0
        public MouseEvent MouseUp(MouseEventArgs e)
        {
            MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, new TPoint(e.X, e.Y));
            InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo);

            if (e.Button == MouseButtons.Left)
            {
                mouseInfo.leftButton = false;
                MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.LUp, mouseInfo, m_previousEvent.Info.position);
                m_previousEvent = mouseEvent;
                return mouseEvent;
            }
            else if (e.Button == MouseButtons.Middle)
            {
                mouseInfo.middleButton = false;
                MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.MUp, mouseInfo, m_previousEvent.Info.position);
                m_previousEvent = mouseEvent;
                return mouseEvent;
            }
            else if (e.Button == MouseButtons.Right)
            {
                mouseInfo.rightButton = false;
                MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.RUp, mouseInfo, m_previousEvent.Info.position);
                m_previousEvent = mouseEvent;
                return mouseEvent;
            }

            return null;
        }
示例#3
0
        public MouseEvent MouseMove(MouseEventArgs e)
        {
            MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, new TPoint(e.X, e.Y));
            InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo);

            MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.Move, mouseInfo, m_previousEvent.Info.position);
            m_previousEvent = mouseEvent;
            return mouseEvent;
        }
示例#4
0
 public override void OnMouseEvent(MouseEvent mouseEvent)
 {
     switch(mouseEvent.State)
     {
         case MouseEvent.EventState.LDown:
             {
                 m_startPosition = mouseEvent.Info.position;
             }
             break;
         case MouseEvent.EventState.LUp:
             {
                 if (CanControlAdd(m_createCommand.CheckImage) == false)
                 {
                     return;
                 }
                 m_createCommand.StartPosition = m_startPosition;
                 m_createCommand.EndPosition = mouseEvent.Info.position;
                 m_commandManager.CurrentCommand = m_createCommand;
                 m_commandManager.Execute();
                 m_stateManager.ChangeState( StateType.Idle );
             }
             break;
     }
 }
示例#5
0
        public MouseEvent MouseWheel(MouseEventArgs e)
        {
            MouseEvent.MouseInfo mouseInfo = new MouseEvent.MouseInfo(false, false, false, new TPoint(e.X, e.Y), e.Delta);
            InheritButtonStatesFromPreviousMouseEvent(ref mouseInfo);
            MouseEvent mouseEvent = new MouseEvent(MouseEvent.EventState.Wheel, mouseInfo);
            m_previousEvent = mouseEvent;

            return mouseEvent;
        }
示例#6
0
 public MouseEventTranslator()
 {
     m_previousEvent = new MouseEvent();
 }
示例#7
0
 private void InheritButtonStatesFromPreviousMouseEvent(ref MouseEvent.MouseInfo mouseInfo)
 {
     if (m_previousEvent != null)
     {
         mouseInfo.leftButton = m_previousEvent.Info.leftButton;
         mouseInfo.middleButton = m_previousEvent.Info.middleButton;
         mouseInfo.rightButton = m_previousEvent.Info.rightButton;
     }
 }
示例#8
0
文件: IdleState.cs 项目: microm/eplib
        public override void OnMouseEvent(MouseEvent mouseEvent)
        {
            if (m_editPanel.LayerInfo == null) return;

            TPoint curPoint = mouseEvent.Info.position;
            switch (mouseEvent.State)
            {
                case MouseEvent.EventState.LDown:
                    {
                        ControlBase control = m_editPanel.LayerInfo.FindControl(curPoint);

                        if (m_editPanel.ModifyController.ExistsAnchorUnder(curPoint ) == false)
                        {
                            SelectEditor(control);
                        }
                        m_mouseDragStartPoint = curPoint;
                        LDownProcess(curPoint,control);
                    }
                    break;
                case MouseEvent.EventState.Move:
                    if (mouseEvent.Info.leftButton == false) return;

                    m_editPanel.MouseDragRect = new Rect(m_mouseDragStartPoint, curPoint);

                    break;
                case MouseEvent.EventState.LUp:
                    if (m_mouseDragStartPoint != curPoint)
                    {
                        SelectDragEditor();
                    }
                    m_editPanel.MouseDragRect = new Rect(0, 0, 0, 0);
                    break;
            }
        }
示例#9
0
文件: StageForm.cs 项目: microm/eplib
 public void OnMouseEvent(MouseEvent mouseEvent)
 {
     if (mouseEvent == null) return;
     m_stateManager.CurrentState.OnMouseEvent(mouseEvent);
 }
示例#10
0
 public abstract void OnMouseEvent(MouseEvent mouseEvent);