diff --git a/js/common/model/Atom2.js b/js/common/model/Atom2.js index 89a7089b..09ed9c5a 100644 --- a/js/common/model/Atom2.js +++ b/js/common/model/Atom2.js @@ -133,8 +133,8 @@ class Atom2 extends Atom { } translatePositionAndDestination( delta ) { - this.positionProperty.value = this.positionProperty.value.add( delta ); - this.destinationProperty.value.add( delta ); + this.positionProperty.value = this.positionProperty.value.plus( delta ); + this.destinationProperty.value = this.destinationProperty.value.plus( delta ); } setPositionAndDestination( point ) { diff --git a/js/common/model/Kit.js b/js/common/model/Kit.js index ea726677..0ade7849 100644 --- a/js/common/model/Kit.js +++ b/js/common/model/Kit.js @@ -488,8 +488,8 @@ class Kit { foundOverlap = true; // get perturbed centers. this is so that if two molecules have the exact same centers, we will push them away - const aCenter = aBounds.center.add( new Vector2( phet.joist.random.nextDouble() - 0.5, phet.joist.random.nextDouble() - 0.5 ) ); - const bCenter = bBounds.center.add( new Vector2( phet.joist.random.nextDouble() - 0.5, phet.joist.random.nextDouble() - 0.5 ) ); + const aCenter = aBounds.center.plus( new Vector2( phet.joist.random.nextDouble() - 0.5, phet.joist.random.nextDouble() - 0.5 ) ); + const bCenter = bBounds.center.plus( new Vector2( phet.joist.random.nextDouble() - 0.5, phet.joist.random.nextDouble() - 0.5 ) ); // delta from center of A to center of B, scaled to half of our push amount. const delta = bCenter.minus( aCenter ).normalized().times( pushAmount ); @@ -648,7 +648,7 @@ class Kit { // cause all atoms in the molecule to move to that location const delta = bestLocation.idealLocation.minus( bestLocation.b.positionProperty.value ); this.getMolecule( bestLocation.b ).atoms.forEach( atomInMolecule => { - atomInMolecule.setPositionAndDestination( atomInMolecule.positionProperty.value.add( delta ) ); + atomInMolecule.setPositionAndDestination( atomInMolecule.positionProperty.value.plus( delta ) ); } ); // we now will bond the atom @@ -695,7 +695,7 @@ class BondingOption { this.b = b; // The location the atom should be placed - this.idealLocation = a.positionProperty.value.add( direction.vector.times( a.covalentRadius + b.covalentRadius ) ); + this.idealLocation = a.positionProperty.value.plus( direction.vector.times( a.covalentRadius + b.covalentRadius ) ); } } diff --git a/js/common/model/LewisDotModel.js b/js/common/model/LewisDotModel.js index e30b9c3d..f40b7ae0 100644 --- a/js/common/model/LewisDotModel.js +++ b/js/common/model/LewisDotModel.js @@ -168,7 +168,7 @@ class LewisDotModel { // if this atom isn't excluded if ( otherDot.atom !== excludedAtom ) { - success = this.mapMolecule( coordinates.add( direction.vector ), otherDot.atom, atom, coordinateMap ); + success = this.mapMolecule( coordinates.plus( direction.vector ), otherDot.atom, atom, coordinateMap ); // if we had a failure mapping that one, bail out if ( !success ) { diff --git a/js/common/model/Molecule.js b/js/common/model/Molecule.js index 8a8022c6..533739d3 100644 --- a/js/common/model/Molecule.js +++ b/js/common/model/Molecule.js @@ -46,8 +46,9 @@ class Molecule extends MoleculeStructure { */ shiftDestination( delta ) { this.atoms.forEach( atom => { + // TODO: memory: consider alternate mutable form atom.destination.add( delta ) atom.isSeparatingProperty.value = true; - atom.destinationProperty.value.add( delta ); + atom.destinationProperty.value = atom.destinationProperty.value.plus( delta ); } ); } } diff --git a/js/common/view/MoleculeBondNode.js b/js/common/view/MoleculeBondNode.js index 35df029d..f579e92a 100644 --- a/js/common/view/MoleculeBondNode.js +++ b/js/common/view/MoleculeBondNode.js @@ -150,7 +150,7 @@ class MoleculeBondNode extends Node { if ( orientation.magnitude > 0 ) { orientation.normalize(); } - const location = orientation.times( this.a.covalentRadius ).add( this.a.positionProperty.value ); + const location = orientation.times( this.a.covalentRadius ).plus( this.a.positionProperty.value ); this.setTranslation( BAMConstants.MODEL_VIEW_TRANSFORM.modelToViewPosition( location ) ); }; this.a.positionProperty.link( this.positionListener );