Skip to content

Commit

Permalink
Add support for only clearing selected atoms
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
  • Loading branch information
ghutchis committed Dec 24, 2020
1 parent 926573b commit b90286b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion avogadro/qtplugins/copypaste/copypaste.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ void CopyPaste::cut()

void CopyPaste::clear()
{
m_molecule->undoMolecule()->clearAtoms();
if (m_molecule->isSelectionEmpty())
m_molecule->undoMolecule()->clearAtoms();
else {
for (Index i = 0; i < m_molecule->atomCount(); ++i)
if (m_molecule->atomSelected(i))
m_molecule->undoMolecule()->removeAtom(i);
}
m_molecule->emitChanged(QtGui::Molecule::Atoms | QtGui::Molecule::Bonds |
QtGui::Molecule::Removed);
}
Expand Down

0 comments on commit b90286b

Please sign in to comment.