Exemple #1
0
 private void OnMouseUp(InputEventMouse e)
 {
     if (m_MouseIsDragging)
     {
         AddEvent(new InputEventMouse(MouseEvent.DragEnd, e));
         m_MouseIsDragging = false;
     }
     else
     {
         if (!DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, c_MouseClickMaxDelta))
         {
             AddEvent(new InputEventMouse(MouseEvent.Click, e));
             if ((m_TheTime - m_LastMouseClickTime <= DoubleClickSeconds) &&
                 !DistanceBetweenPoints(m_LastMouseClick.Position, e.Position, c_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;
 }
Exemple #2
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     EventType = eventType;
     m_Button = parent.m_Button;
     m_Clicks = parent.m_Clicks;
     X = parent.X;
     Y = parent.Y;
     MouseData = parent.MouseData;
 }
Exemple #3
0
 public InputEventMouse(MouseEvent eventType, InputEventMouse parent)
     : base(parent)
 {
     EventType = eventType;
     m_Button  = parent.m_Button;
     m_Clicks  = parent.m_Clicks;
     X         = parent.X;
     Y         = parent.Y;
     MouseData = parent.MouseData;
 }
Exemple #4
0
 private void OnMouseMove(InputEventMouse e)
 {
     AddEvent(new InputEventMouse(MouseEvent.Move, e));
     if (!m_MouseIsDragging && m_LastMouseDown != null)
     {
         if (DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, c_MouseDragBeginDistance))
         {
             AddEvent(new InputEventMouse(MouseEvent.DragBegin, e));
             m_MouseIsDragging = true;
         }
     }
 }
Exemple #5
0
 public bool HandleMouseEvent(MouseEvent type, MouseButton mb)
 {
     foreach (InputEvent e in m_EventsThisFrame)
     {
         if (!e.Handled && e is InputEventMouse)
         {
             InputEventMouse em = (InputEventMouse)e;
             if (em.EventType == type && em.Button == mb)
             {
                 e.Handled = true;
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #6
0
 /// <summary>
 /// Raises the MouseWheel event. Override this method to add code to handle when a mouse wheel is turned
 /// </summary>
 /// <param name="e">InputEventCM for the MouseWheel event</param>
 private void InvokeMouseWheel(InputEventMouse e)
 {
     if (MouseWheel != null)
         MouseWheel(e);
 }
Exemple #7
0
 /// <summary>
 /// Raises the MouseUp event. Override this method to add code to handle when a mouse button is released
 /// </summary>
 /// <param name="e">InputEventCM for the MouseUp event</param>
 private void InvokeMouseUp(InputEventMouse e)
 {
     if (MouseUp != null)
         MouseUp(e);
 }
Exemple #8
0
 /// <summary>
 /// Raises the MouseMove event. Override this method to add code to handle when the mouse is moved
 /// </summary>
 /// <param name="e">InputEventCM for the MouseMove event</param>
 private void InvokeMouseMove(InputEventMouse e)
 {
     if (MouseMove != null)
         MouseMove(e);
 }
Exemple #9
0
 /// <summary>
 /// Raises the MouseDown event. Override this method to add code to handle when a mouse button is pressed
 /// </summary>
 /// <param name="e">InputEventCM for the MouseDown event</param>
 private void InvokeMouseDown(InputEventMouse e)
 {
     if (MouseDown != null)
         MouseDown(e);
 }
Exemple #10
0
 private void OnMouseWheel(InputEventMouse e)
 {
     AddEvent(e);
 }
Exemple #11
0
 private void OnMouseUp(InputEventMouse e)
 {
     if (m_MouseIsDragging) {
         AddEvent(new InputEventMouse(MouseEvent.DragEnd, e));
         m_MouseIsDragging = false;
     }
     else {
         if (!DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, c_MouseClickMaxDelta)) {
             AddEvent(new InputEventMouse(MouseEvent.Click, e));
             if ((m_TheTime - m_LastMouseClickTime <= DoubleClickSeconds) &&
                 !DistanceBetweenPoints(m_LastMouseClick.Position, e.Position, c_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;
 }
Exemple #12
0
 private void OnMouseMove(InputEventMouse e)
 {
     AddEvent(new InputEventMouse(MouseEvent.Move, e));
     if (!m_MouseIsDragging && m_LastMouseDown != null) {
         if (DistanceBetweenPoints(m_LastMouseDown.Position, e.Position, c_MouseDragBeginDistance)) {
             AddEvent(new InputEventMouse(MouseEvent.DragBegin, e));
             m_MouseIsDragging = true;
         }
     }
 }
Exemple #13
0
 private void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }
Exemple #14
0
 private void OnMouseWheel(InputEventMouse e)
 {
     AddEvent(e);
 }
Exemple #15
0
 private void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown     = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }