private void canvas1_KeyDown(object sender, KeyEventArgs e) { // route event to current tool TEKeyArgs ee = e.ToTEKeyArgs(); TheModel.CurrentTool.KeyDown(ee); e.Handled = ee.Handled; // turn off raster on Alt Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift); Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift); if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt) { e.Handled = true; } if (!e.Handled) { // escape cancels current operation if (e.Key == Key.Escape) { TheModel.ActivateDefaultTool(); } } }
public override void KeyUp(TEKeyArgs e) { base.KeyUp(e); // if (PreviewArc.Visibility == Visibility.Visible) // AdjustPreviewPos(); }
public override void KeyUp(TEKeyArgs e) { base.KeyUp(e); // refresh preview rect size in case CTRL was pressed if (PreviewEllipse.Visible) { Point p = new Point(overlay.CursorPosition.X, overlay.Height - overlay.CursorPosition.Y); OnMouseMove(p, null); } }
private void canvas1_KeyUp(object sender, KeyEventArgs e) { // route event to current tool TEKeyArgs ee = e.ToTEKeyArgs(); TheModel.CurrentTool.KeyUp(ee); e.Handled = ee.Handled; // turn on raster on Alt released Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift); Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift); if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt) { e.Handled = true; } }
public override void KeyDown(TEKeyArgs e) { // move the selected object if (SelectedItems.Count > 0) { double x = 0, y = 0; if (e.KeyCode == Keys.Right) { x = 1; } else if (e.KeyCode == Keys.Left) { x = -1; } else if (e.KeyCode == Keys.Down) { y = -1; } else if (e.KeyCode == Keys.Up) { y = 1; } if (x != 0 || y != 0) { double step = overlay.Rasterizer.GridWidth * .1; if (step == 0) { step = 1; } overlay.BeginUpdate(); ShiftSelItemsInParseTree(new Point(x * step, y * step), overlay.TopLevelItems); overlay.EndUpdate(); // update overlay positions foreach (OverlayShape o in overlay.TopLevelItems) { o.AdjustPosition(overlay.Resolution); } e.Handled = true; } } base.KeyDown(e); }
/// <summary> /// KeyUp event, forwarded from the overlay control. /// </summary> /// <param name="e"></param> public virtual void KeyUp(TEKeyArgs e) { }
/// <summary> /// KeyDown event, forwarded from the overlay control. /// </summary> /// <param name="e"></param> public virtual void KeyDown(TEKeyArgs e) { }
public override void KeyUp(TEKeyArgs e) { base.KeyUp(e); UpdatePreviewDisplay(); }
public override void KeyDown(TEKeyArgs e) { // move the selected object if (SelectedItems.Count > 0) { double x=0, y=0; if (e.KeyCode == Keys.Right) x = 1; else if (e.KeyCode == Keys.Left) x = -1; else if (e.KeyCode == Keys.Down) y = -1; else if (e.KeyCode == Keys.Up) y = 1; if (x != 0 || y != 0) { double step = overlay.Rasterizer.GridWidth * .1; if (step == 0) step = 1; overlay.BeginUpdate(); ShiftSelItemsInParseTree(new Vector(x * step, y * step), overlay.DisplayTree.TopLevelItems); overlay.EndUpdate(); // update overlay positions overlay.DisplayTree.AdjustPositions(); e.Handled = true; } } base.KeyDown(e); }