Skip to content

Commit

Permalink
Don't change showLonePairsProperty without the user trying to change …
Browse files Browse the repository at this point in the history
…it, see #201
  • Loading branch information
jonathanolson committed Jan 20, 2022
1 parent 3941181 commit e73a406
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions js/model/ModelMoleculesModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ class ModelMoleculesModel extends MoleculeShapesModel {

this.moleculeProperty.value.addCentralAtom( new PairGroup( new Vector3( 0, 0, 0 ), false ) );
this.setupInitialMoleculeState();

const bondChangedListener = () => {
if ( this.moleculeProperty.value.radialLonePairs.length === 0 ) {
this.showLonePairsProperty.value = true;
}
};

// when the molecule is made empty, make sure to show lone pairs again (will allow us to drag out new ones)
this.moleculeProperty.link( ( newMolecule, oldMolecule ) => {
if ( oldMolecule ) {
oldMolecule.bondChangedEmitter.removeListener( bondChangedListener );
}
if ( newMolecule ) {
newMolecule.bondChangedEmitter.addListener( bondChangedListener );
}
bondChangedListener();
} );
}

/**
Expand Down

0 comments on commit e73a406

Please sign in to comment.