Exemplo n.º 1
0
        /// <summary>
        /// Reduces digraph image by moving vertices
        /// </summary>
        private void ReduceButton_Click(object sender, EventArgs e)
        {
            var command = new ResizeDigraphCommand(digraph, 0.9);

            commandsManager.Execute(command);
            UpdateImage();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes commands to move digraph itself
        /// </summary>
        private void MainWindow_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.ControlKey)
            {
                isControlPressed = false;
            }
            if (e.Modifiers != Keys.Control && sender != MouseWheelTimer)
            {
                return;
            }
            if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down ||
                e.KeyCode == Keys.Right || e.KeyCode == Keys.Left)
            {
                if (xCoefficient == 0 && yCoefficient == 0)
                {
                    return;
                }
                var command = new MoveDigraphCommand(digraph, xCoefficient, yCoefficient);
                commandsManager.Execute(command);
                xCoefficient = yCoefficient = 0;
            }

            if (e.KeyCode == Keys.OemMinus || e.KeyCode == Keys.Oemplus)
            {
                var command = new ResizeDigraphCommand(digraph, resizeCoefficient);
                commandsManager.Execute(command);
                resizeCoefficient = 1;
            }
        }