Skip to content

Commit 5f7ec84

Browse files
samreidjessegreenberg
authored andcommitted
Opt out of tandem for Photons used to create icons, see phetsims/molecules-and-light#353
1 parent 2924ed4 commit 5f7ec84

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

js/photon-absorption/model/Photon.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
import Vector2 from '../../../../dot/js/Vector2.js';
1313
import Vector2Property from '../../../../dot/js/Vector2Property.js';
1414
import inherit from '../../../../phet-core/js/inherit.js';
15+
import merge from '../../../../phet-core/js/merge.js';
1516
import CouldNotYetDeserializeError from '../../../../tandem/js/CouldNotYetDeserializeError.js';
1617
import PhetioObject from '../../../../tandem/js/PhetioObject.js';
18+
import Tandem from '../../../../tandem/js/Tandem.js';
1719
import IOType from '../../../../tandem/js/types/IOType.js';
1820
import NumberIO from '../../../../tandem/js/types/NumberIO.js';
1921
import moleculesAndLight from '../../moleculesAndLight.js';
@@ -22,13 +24,19 @@ import moleculesAndLight from '../../moleculesAndLight.js';
2224
* Constructor for a photon.
2325
*
2426
* @param {Number} wavelength
25-
* @param {Tandem} tandem
27+
* @param {Object} [options]
2628
* @constructor
2729
*/
28-
function Photon( wavelength, tandem ) {
30+
function Photon( wavelength, options ) {
31+
32+
options = merge( {
33+
tandem: Tandem.REQUIRED,
34+
phetioType: Photon.PhotonIO,
35+
phetioDynamicElement: true
36+
}, options );
2937

3038
this.positionProperty = new Vector2Property( new Vector2( 0, 0 ), {
31-
tandem: tandem.createTandem( 'positionProperty' )
39+
tandem: options.tandem.createTandem( 'positionProperty' )
3240
} );
3341

3442
// @private
@@ -37,11 +45,7 @@ function Photon( wavelength, tandem ) {
3745
this.vy = 0; // y component of the photon velocity
3846

3947
// Photons in the play area are instrumented, those in the control panel (for icons) are not.
40-
PhetioObject.call( this, {
41-
tandem: tandem,
42-
phetioType: Photon.PhotonIO,
43-
phetioDynamicElement: true
44-
} );
48+
PhetioObject.call( this, options );
4549
}
4650

4751
moleculesAndLight.register( 'Photon', Photon );

js/photon-absorption/model/PhotonAbsorptionModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function PhotonAbsorptionModel( initialPhotonTarget, tandem ) {
8080
this.photonAbsorptionModel = tandem; // @private
8181

8282
// @private
83-
this.photonGroup = new PhetioGroup( ( tandem, wavelength ) => new Photon( wavelength, tandem ), [ WavelengthConstants.IR_WAVELENGTH ], {
83+
this.photonGroup = new PhetioGroup( ( tandem, wavelength ) => new Photon( wavelength, { tandem: tandem } ), [ WavelengthConstants.IR_WAVELENGTH ], {
8484
phetioType: PhetioGroup.PhetioGroupIO( Photon.PhotonIO ),
8585
tandem: tandem.createTandem( 'photonGroup' )
8686
} );

0 commit comments

Comments
 (0)