/// <summary> /// Moves digraph image according to mouse wheel scrolling /// </summary> private void MainWindow_MouseWheel(object sender, MouseEventArgs e) { MouseWheelTimer.Start(); if (isControlPressed) { if (e.Delta > 0) { GraphBuilder_KeyDown(e, new KeyEventArgs(Keys.Oemplus)); } else if (e.Delta < 0) { GraphBuilder_KeyDown(e, new KeyEventArgs(Keys.OemMinus)); } } else { if (e.Delta > 0) { GraphBuilder_KeyDown(e, new KeyEventArgs(Keys.Up)); } else if (e.Delta < 0) { GraphBuilder_KeyDown(e, new KeyEventArgs(Keys.Down)); } } }
/// <summary> /// Changes vertices radius /// </summary> private void RadiusTrackBar_ValueChanged(object sender, EventArgs e) { graphDrawing.R = RadiusTrackBar.Value; RadiusValueLabel.Text = @"R = " + RadiusTrackBar.Value; if (!isCommand) { radiusChanged = true; MouseWheelTimer.Start(); } else { radius = RadiusTrackBar.Value; } }
/// <summary> /// Moves digraph itself according to mouse wheel scrolling /// </summary> private void WheelStopped(object sender, EventArgs e) { MouseWheelTimer.Stop(); if (xCoefficient != 0 || yCoefficient != 0) { MainWindow_KeyUp(MouseWheelTimer, new KeyEventArgs(Keys.Up)); } if (Math.Abs(resizeCoefficient - 1) > 0) { MainWindow_KeyUp(MouseWheelTimer, new KeyEventArgs(Keys.OemMinus)); } if (!radiusChanged) { return; } radiusChanged = false; var command = new ChangeRadiusCommand(graphDrawing, radius, graphDrawing.R); command.Executed += (s, ea) => RadiusTrackBar.Value = (int)s; commandsManager.Execute(command); radius = graphDrawing.R; }