示例#1
0
        void OnMouseUp(InputEventMouse e)
        {
            if (m_MouseIsDragging)
            {
                AddEvent(new InputEventMouse(MouseEvent.DragEnd, e));
                m_MouseIsDragging = false;
            }
            else
            {
                if (m_LastMouseDown != null)
                {
                    if (!DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseClickMaxDelta))
                    {
                        AddEvent(new InputEventMouse(MouseEvent.Click, e));

                        if ((m_TheTime - m_LastMouseClickTime <= Settings.UserInterface.Mouse.DoubleClickMS) &&
                            !DistanceBetweenPoints(m_LastMouseClick.Position, e.Position, MouseClickMaxDelta))
                        {
                            m_LastMouseClickTime = 0f;
                            AddEvent(new InputEventMouse(MouseEvent.DoubleClick, e));
                        }
                        else
                        {
                            m_LastMouseClickTime = m_TheTime;
                            m_LastMouseClick     = e;
                        }
                    }
                }
            }
            AddEvent(new InputEventMouse(MouseEvent.Up, e));
            m_LastMouseDown = null;
        }
示例#2
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     EventType   = eventType;
     m_Buttons   = parent.m_Buttons;
     m_Clicks    = parent.m_Clicks;
     X           = parent.X;
     Y           = parent.Y;
     m_MouseData = parent.m_MouseData;
 }
示例#3
0
 void OnMouseMove(InputEventMouse e)
 {
     AddEvent(new InputEventMouse(MouseEvent.Move, e));
     if (!m_MouseIsDragging && m_LastMouseDown != null)
     {
         if (DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, MouseDragBeginDistance))
         {
             AddEvent(new InputEventMouse(MouseEvent.DragBegin, e));
             m_MouseIsDragging = true;
         }
     }
 }
示例#4
0
 public bool HandleMouseEvent(MouseEvent type, MouseButton mb)
 {
     foreach (InputEvent e in m_Events)
     {
         if (!e.Handled && e is InputEventMouse)
         {
             InputEventMouse em = (InputEventMouse)e;
             if (em.EventType == type && em.Button == mb)
             {
                 e.Handled = true;
                 return(true);
             }
         }
     }
     return(false);
 }
示例#5
0
 void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown     = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }