示例#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;
 }
示例#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;
 }
示例#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;
 }
示例#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;
         }
     }
 }
示例#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);
 }
示例#6
0
文件: WndProc.cs 项目: ZaneDubya/YCPU
 /// <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);
 }
示例#7
0
文件: WndProc.cs 项目: ZaneDubya/YCPU
 /// <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);
 }
示例#8
0
文件: WndProc.cs 项目: ZaneDubya/YCPU
 /// <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);
 }
示例#9
0
文件: WndProc.cs 项目: ZaneDubya/YCPU
 /// <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);
 }
示例#10
0
 private void OnMouseWheel(InputEventMouse e)
 {
     AddEvent(e);
 }
示例#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;
 }
示例#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;
         }
     }
 }
示例#13
0
 private void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }
示例#14
0
 private void OnMouseWheel(InputEventMouse e)
 {
     AddEvent(e);
 }
示例#15
0
 private void OnMouseDown(InputEventMouse e)
 {
     m_LastMouseDown     = e;
     m_LastMouseDownTime = m_TheTime;
     AddEvent(m_LastMouseDown);
 }