From 1da39cb6370595c7ea26705e51432a22d04c6d01 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Wed, 21 Jul 2021 17:07:24 -0400 Subject: [PATCH] When dragging to create a new atom, use starting coords Fixes #680 as suggested by @MSoegtropIMC Signed-off-by: Geoff Hutchison --- avogadro/qtplugins/editor/editor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avogadro/qtplugins/editor/editor.cpp b/avogadro/qtplugins/editor/editor.cpp index 1f30cf66b8..06a272561f 100644 --- a/avogadro/qtplugins/editor/editor.cpp +++ b/avogadro/qtplugins/editor/editor.cpp @@ -550,14 +550,14 @@ void Editor::atomLeftDrag(QMouseEvent* e) if (!m_newObject.isValid()) { // Add a new atom bonded to the clicked atom RWAtom clickedAtom = m_molecule->atom(m_clickedObject.index); - newAtom = m_molecule->addAtom(m_toolWidget->atomicNumber()); + newAtom = m_molecule->addAtom(m_toolWidget->atomicNumber(), clickedAtom.position3d()); // Handle the automatic bond order int bondOrder = m_toolWidget->bondOrder(); if (bondOrder == 0) { // automatic - guess the size bondOrder = expectedBondOrder(clickedAtom, newAtom); - } + } m_molecule->addBond(clickedAtom, newAtom, bondOrder); // now if we need to adjust hydrogens, do it