Exemple #1
0
        public override InputMessageResult HandleMessage(InputMessage message)
        {
            switch (message.MessageType)
            {
            case InputMessageType.MouseMove:
                _mousePos = message.Value.MousePosition;

                if (_system.Selecting)
                {
                    _system.OnDragSelection(_mousePos);
                }
                else
                {
                    _system.OnHoverSelection(_mousePos);
                }

                break;

            case InputMessageType.MouseLeftButtonDown:
                _system.OnStartDragSelection(_mousePos);
                return(InputMessageResult.Handled);

            case InputMessageType.MouseLeftButtonUp:
                if (_system.Selecting)
                {
                    _system.OnEndDragSelection();
                }
                break;
            }

            return(InputMessageResult.NotHandled);
        }
        public override InputMessageResult HandleMessage(InputMessage message)
        {
            switch (message.MessageType)
            {
            case InputMessageType.MouseMove:
                _mousePos = message.Value.MousePosition;

                if (_system.Selecting)
                {
                    _system.OnDragSelection(_mousePos);
                }
                else if (!_system.Panning)
                {
                    _system.OnHoverSelection(_mousePos);
                }

                break;

            case InputMessageType.MouseLeftButtonDown:
                _system.OnStartDragSelection(_mousePos);
                return(InputMessageResult.Handled);

            case InputMessageType.MouseLeftButtonUp:
                if (_system.Selecting)
                {
                    _system.OnEndDragSelection();
                }
                break;

            case InputMessageType.MouseRightButtonDown:
                _system.OnStartRightClickDrag(_mousePos);
                break;

            case InputMessageType.MouseRightButtonUp:
                if (_system.Panning)
                {
                    // we need to pass in the position directly instead of relying on MouseMove as in my experience
                    // when moving quickly MouseMove wouldn't be called before MouseRightButtonUp
                    _system.OnEndRightClickDrag(message.Value.MousePosition);
                }
                break;
            }

            return(InputMessageResult.NotHandled);
        }