public void MoveKeyDown() { if (!IsStarted) { EditFigList = Controller.StartEdit(); Delta = Vector3d.Zero; IsStarted = true; } Vector3d wx = Controller.DC.DevVectorToWorldVector(Vector3d.UnitX); Vector3d wy = Controller.DC.DevVectorToWorldVector(Vector3d.UnitY); wx = wx.UnitVector() / Controller.DC.WorldScale; wy = wy.UnitVector() / Controller.DC.WorldScale; wx *= SettingsHolder.Settings.KeyMoveUnit; wy *= SettingsHolder.Settings.KeyMoveUnit; if (CadKeyboard.IsKeyPressed(System.Windows.Forms.Keys.Left)) { Delta -= wx; } if (CadKeyboard.IsKeyPressed(System.Windows.Forms.Keys.Right)) { Delta += wx; } if (CadKeyboard.IsKeyPressed(System.Windows.Forms.Keys.Up)) { Delta -= wy; } if (CadKeyboard.IsKeyPressed(System.Windows.Forms.Keys.Down)) { Delta += wy; } if (Controller.State == PlotterController.States.SELECT) { if (EditFigList != null && EditFigList.Count > 0) { Controller.MovePointsFromStored(EditFigList, Delta); Controller.Redraw(); } else { Vector3d p = Controller.GetCursorPos(); Controller.SetCursorWoldPos(p + Delta); Controller.Redraw(); } } }
protected void CadObjectTree_MouseDown(object sender, MouseButtonEventArgs e) { Point p = e.GetPosition(this); int idx = (int)(p.Y / mItemHeight); if (!ShowRoot) { idx++; } CadObjTreeItem item = mRoot.GetAt(idx); if (item == null) { return; } if (e.RightButton == MouseButtonState.Pressed) { mRoot.ForEachAll((v) => { v.IsChecked = false; }); item.IsChecked = true; OnCheckChanged(item); if (ItemCommand != null) { mContextMenu.Items.Clear(); List <MenuItem> list = item.GetContextMenuItems(); if (list != null) { foreach (MenuItem m in list) { SetupContextMenuItem(m); mContextMenu.Items.Add(m); } } if (mContextMenu.Items.Count > 0) { ContextMenu = mContextMenu; } else { ContextMenu = null; } base.OnMouseDown(e); } } else { if (!CadKeyboard.IsCtrlKeyDown()) { mRoot.ForEachAll((v) => { v.IsChecked = false; }); } int level = item.GetLevel(); if (item.Children != null) { if (p.X > (level) * mIndentSize) { item.IsChecked = item.IsChecked == false; OnCheckChanged(item); } else { item.IsExpand = item.IsExpand == false; RecalcSize(); } } else { item.IsChecked = item.IsChecked == false; OnCheckChanged(item); } } InvalidateVisual(); }