예제 #1
0
        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;
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        private void HandleJoystickButtonUp(JoystickButtonUpEventArgs args)
        {
            switch (args.Button)
            {
            case 0:
                ClickComplete?.Invoke(this, GetSimleEventArg());
                break;

            case 1:
                AltClickComplete?.Invoke(this, GetSimleEventArg());
                break;
            }
        }