private void CurrentEditor_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var hitTestResult = CurrentEditor.ActiveVisual; if (hitTestResult is GroupVisual gv) { var parent = gv.ParentMolecule; EditViewModel.DeleteMolecule(parent); CurrentStatus = "Group deleted"; } else if (hitTestResult is AtomVisual atomVisual) { var atom = atomVisual.ParentAtom; this.EditViewModel.DeleteAtoms(new[] { atom }); CurrentStatus = "Atom deleted."; } else if (hitTestResult is BondVisual bondVisual) { var bond = bondVisual.ParentBond; this.EditViewModel.DeleteBonds(new[] { bond }); CurrentStatus = "Bond deleted"; } EditViewModel.ClearSelection(); }