public override void OnMouseDown(PointD3D position, MouseButtonEventArgs e) { base.OnMouseDown(position, e); if (e.ChangedButton == MouseButton.Left) { var hitData = new HitTestPointData(_grac.Doc.Camera.GetHitRayMatrix(position)); // first, if we have a mousedown without shift key and the // position has changed with respect to the last mousedown // we have to deselect all objects var keyboardModifiers = System.Windows.Input.Keyboard.Modifiers; bool bControlKey = keyboardModifiers.HasFlag(ModifierKeys.Control); bool bShiftKey = keyboardModifiers.HasFlag(ModifierKeys.Shift); ActiveGrip = GripHitTest(hitData); if ((ActiveGrip is SuperGrip) && (bShiftKey || bControlKey)) { var superGrip = ActiveGrip as SuperGrip; if (superGrip.GetHittedElement(hitData, out var gripHandle, out var hitTestObj)) { _selectedObjects.Remove(hitTestObj); superGrip.Remove(gripHandle); return; } } else if (ActiveGrip != null) { ActiveGrip.Activate(hitData, false); return; } _grac.FindGraphObjectAtPixelPosition(hitData, false, out var clickedObject, out var clickedLayerNumber); if (!bShiftKey && !bControlKey) // if shift or control are pressed, we add the object to the selection list and start moving mode { ClearSelections(); } if (null != clickedObject) { AddSelectedObject(hitData, clickedObject); } } }