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; }
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; }
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; } } }
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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
private void OnMouseWheel(InputEventMouse e) { AddEvent(e); }
private void OnMouseDown(InputEventMouse e) { m_LastMouseDown = e; m_LastMouseDownTime = m_TheTime; AddEvent(m_LastMouseDown); }