예제 #1
0
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            if (ArrowsToMove)
            {
                Point?keyMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData).GetKeyMove();
                if (keyMove.HasValue)
                {
                    return(MoveMap(keyMove.Value));
                }
                else
                {
                    switch (e.KeyEventArgs.KeyData)
                    {
                    case Keys.Home:
                        _map.GoHome();
                        return(true);

                    case Keys.Add:
                        _map.IncreaseZoomLevel(1);
                        return(true);

                    case Keys.Subtract:
                        _map.IncreaseZoomLevel(-1);
                        return(true);
                    }
                }
            }
            return(false);
        }
        /// <summary>
        /// Grow or shrink the ActiveRectangle.
        /// Stop the Tooltip.
        /// </summary>
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            Point? keyMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData).GetKeyMove();
            if (keyMove.HasValue)
            {
                _activeRectangle.Width += keyMove.Value.X;
                _activeRectangleSize.Width += keyMove.Value.X;
                _activeRectangleSize.Height -= keyMove.Value.Y;
                _activeRectangle.Height -= keyMove.Value.Y;
                return true;
            }
            else
            {
                const int step = 5;
                const int largeStep = 20;
                switch (e.KeyEventArgs.KeyData)
                {
                    case Keys.Subtract | Keys.Control:
                        InflateActiveRectangle(-largeStep);
                        return true;

                    case Keys.Add | Keys.Control:
                        InflateActiveRectangle(largeStep);
                        return true;

                    case Keys.Add:
                        InflateActiveRectangle(step);
                        return true;

                    case Keys.Subtract:
                        InflateActiveRectangle(-step);
                        return true;

                    case Keys.S:
                        _showHelpTooltip = false;
                        return true;
                }
            }
            return false;
        }
예제 #3
0
        /// <summary>
        /// Handles keypresses on the map
        /// </summary>
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            if (ActivePolygon != null)
            {
                if (e.KeyEventArgs.KeyCode == Keys.Delete)
                {
                    Delete(ActivePolygon);
                    return true;
                }

                if (!ActivePolygon.Drawing)
                {
                    var polygonMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData, 1, 5).GetKeyMove();
                    if (polygonMove.HasValue)
                    {
                        ActivePolygon.Move(polygonMove.Value);
                        return true;
                    }
                }
            }
            return false;
        }
예제 #4
0
        protected internal override bool OnKeyDownCore(MapKeyEventArgs e)
        {
            if (ArrowsToMove)
            {
                Point? keyMove = new KeyboardInputToMovementConverter(e.KeyEventArgs.KeyData).GetKeyMove();
                if (keyMove.HasValue)
                {
                    return MoveMap(keyMove.Value);
                }
                else
                {
                    switch (e.KeyEventArgs.KeyData)
                    {
                        case Keys.Home:
                            _map.GoHome();
                            return true;

                        case Keys.Add:
                            _map.IncreaseZoomLevel(1);
                            return true;

                        case Keys.Subtract:
                            _map.IncreaseZoomLevel(-1);
                            return true;
                    }
                }
            }
            return false;
        }