Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public override InputMessageResult HandleMessage(InputMessage message)
        {
            switch (message.MessageType)
            {
            case InputMessageType.MouseMove:
                _mousePos = message.Value.MousePosition;

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

                break;

            case InputMessageType.MouseLeftButtonDown:
                // HACK?: If the camera is being rotated using ALT+Mouse1, don't handle the event.
                // This check shouldn't really be here.
                if (_altDown)
                {
                    break;
                }

                _system.OnStartDragSelection(_mousePos);
                return(InputMessageResult.Handled);

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

                break;

            case InputMessageType.KeyDown:
                if (message.Value.Key == Key.LAlt)
                {
                    _altDown = true;
                }

                break;

            case InputMessageType.KeyUp:
                if (message.Value.Key == Key.LAlt)
                {
                    _altDown = false;
                }

                break;
            }

            return(InputMessageResult.NotHandled);
        }
Ejemplo n.º 3
0
        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);
        }