phetsims / build-a-molecule

"Build a Molecule" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
8 stars 7 forks source link

Bond cut targets don't restore when switching kits #172

Closed Denz1994 closed 4 years ago

Denz1994 commented 4 years ago

To replicate this bug follow these steps:

  1. Create a molecule on Kit A
  2. Click on an atom in the molecule to show all the bond cut targets (yellow circles)
  3. Click carousel button to go to Kit B
  4. Click carousel button to go back to Kit A
  5. Click on an atom in the molecule. At this point, the bond cut targets won't show up.
Denz1994 commented 4 years ago

The MoleculeContainerBondNode and MoleculeControlsHBox are added to the KitPlayAreaNode.metadataLayer. This means this check will fail for MoleculeControlsHBox because MoleculeContainerBondNode.molecule is undefined. metadataNode.visible = kit.molecules.includes( metadataNode.molecule ) && active ;

It would be best to separate the molecule controls and the molecule bond containers into their own layers.

Denz1994 commented 4 years ago

The above commit fixed the buggy behavior described above. This is an overall improvement to the organization of the KitPlayAreaNode components.