-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unselected atoms become selected (and vice versa) when other atoms are deleted #650
Comments
This issue has been mentioned on Avogadro Discussion. There might be relevant details there: |
Two bugs in one - selected items weren't updated by Molecule class and atoms were removed in a bad order. (Remove in reverse to keep Index correct) Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
Here are the build results |
@drew-parsons @mquevill - as far as I can tell, the patch fixes the problem... |
The patch looks like it's making the right corrections. The codebase has diverged from 1.94.0 now so I can't apply and test so easily as a single patch. |
Bug raised by @mquevill - delete a non-selected atom Since deleting atoms renumbers, make sure selected atoms stays with "swap and pop" form from atom index, etc. Signed-off-by: Geoff Hutchison <geoff.hutchison@gmail.com>
Here are the build results |
**Avogadro version: 1.94.0-371-g7479d2e **
**Desktop version: **
Describe the bug
When some atoms in a molecule are selected, and other atoms are then deleted, some of the selected atoms become deselected.
Conversely if some selected atoms are deleted, then some previously deselected atoms suddenly become selected.
My guess is that the list of selected atoms is a list of indices to the atoms in the molecule, and is not refreshed when the lists of atoms in the molecule changes (e,g, by deletion).
To Reproduce
Steps to reproduce the behavior:
Create a simple ethane molecule
Click on Selection Tool and select the right-most methyl
![Screenshot from 2021-07-06 16-41-20](https://user-images.githubusercontent.com/26508288/124619551-09b1fa00-de79-11eb-9d79-31f64a5f2cce.png)
Select Build [pencil] tool
Delete (right-click) one of the unselected hydrogens on the left. That hydrogen disappears, but one of the hydrogens on the right becomes deselected.
![Screenshot from 2021-07-06 16-38-59](https://user-images.githubusercontent.com/26508288/124619237-c3f53180-de78-11eb-832c-2aa22ee57b0c.png)
Conversely,
![Screenshot from 2021-07-06 16-31-23](https://user-images.githubusercontent.com/26508288/124618220-e63a7f80-de77-11eb-89f8-0bc7e29bc573.png)
2'. Click on Selection Tool and select the left-most methyl
4'. Delete (right-click) one of the selected hydrogens on the left. That hydrogen disappears, but one of the hydrogens on the right becomes selected.
![Screenshot from 2021-07-06 16-31-44](https://user-images.githubusercontent.com/26508288/124618471-1b46d200-de78-11eb-96a1-7797365dd5e6.png)
Expected behavior
Previously deselected atoms should not suddenly become selected when atoms are removed (or added).
Previously selected atoms should not suddenly become deselected when atoms are removed (or added) (or alternatively the entire selection should get cleared).
The text was updated successfully, but these errors were encountered: