private void HandleMouseButtonUp(MouseButtonUpEventArgs args) { if (args.Button == 1) { if (_mouseTouch != null) { _mouseTouch = new TouchState { ID = MouseTouchID, ScreenPosition = Input.MousePosition, Pressure = 0.0f }; EndTouch(_mouseTouch); _mouseTouch = null; } } if (args.Button == 4) { if (_potentialRightClick) { AltClickComplete?.Invoke(this, new SimpleInteractionEventArgs(_environment.Raycast(Input.MousePosition))); _potentialRightClick = false; } _rigthClick = null; } }
private void EndTouch(TouchState touch) { var index = IndexOfTouch(touch); if (index < 0) { return; } var duration = _activeTouches[index].Duration; _activeTouches.RemoveAt(index); if (_activeTouches.Count == 0) { if (_potentialClick) { var contact = _environment.Raycast(touch.ScreenPosition); if (duration > AltClickDuration) { ClickCanceled?.Invoke(this, new SimpleInteractionEventArgs(contact)); AltClickComplete?.Invoke(this, new SimpleInteractionEventArgs(contact)); } else { ClickComplete?.Invoke(this, new SimpleInteractionEventArgs(contact)); } _potentialClick = true; } } else if (_activeTouches.Count >= 2) { UpdateMultitouch(); } }
private void HandleJoystickButtonUp(JoystickButtonUpEventArgs args) { switch (args.Button) { case 0: ClickComplete?.Invoke(this, GetSimleEventArg()); break; case 1: AltClickComplete?.Invoke(this, GetSimleEventArg()); break; } }