Skip to content

Commit

Permalink
set phet-io "featured" flag for elements of screen 2, see #63
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Dec 13, 2024
1 parent e81913d commit e66e8a2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
3 changes: 2 additions & 1 deletion js/common/model/TwoStateSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default class TwoStateSystem<T extends string> extends TwoStateSystemSet<
this.measuredValueProperty = new Property( initialState, {
tandem: options.tandem.createTandem( 'measuredValueProperty' ),
phetioValueType: StringUnionIO( stateValues ),
validValues: [ ...stateValues ]
validValues: [ ...stateValues ],
phetioFeatured: true
} );

// Hook up to the data-changed emitter to update the data Property.
Expand Down
11 changes: 8 additions & 3 deletions js/photons/model/Laser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,24 @@ class Laser {

this.emissionRateProperty = new NumberProperty( 0, {
range: new Range( 0, MAX_PHOTON_EMISSION_RATE ),

// Only instrument this in the manyPhotons mode, since it's not relevant in the singlePhoton mode.
tandem: providedOptions.emissionMode === 'manyPhotons' ?
providedOptions.tandem.createTandem( 'emissionRateProperty' ) :
Tandem.OPT_OUT
Tandem.OPT_OUT,
phetioFeatured: providedOptions.emissionMode === 'manyPhotons'
} );

this.presetPolarizationDirectionProperty = new Property<PolarizationPresets>( 'fortyFiveDegrees', {
tandem: providedOptions.tandem.createTandem( 'presetPolarizationDirectionProperty' ),
phetioValueType: StringUnionIO( PolarizationPresetValues ),
validValues: PolarizationPresetValues
validValues: PolarizationPresetValues,
phetioFeatured: true
} );
this.customPolarizationAngleProperty = new NumberProperty( 45, {
range: new Range( 0, 90 ),
tandem: providedOptions.tandem.createTandem( 'customPolarizationAngleProperty' )
tandem: providedOptions.tandem.createTandem( 'customPolarizationAngleProperty' ),
phetioFeatured: true
} );


Expand Down
11 changes: 9 additions & 2 deletions js/photons/model/PhotonsExperimentSceneModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Vector2 from '../../../../dot/js/Vector2.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import isSettingPhetioStateProperty from '../../../../tandem/js/isSettingPhetioStateProperty.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import NullableIO from '../../../../tandem/js/types/NullableIO.js';
import NumberIO from '../../../../tandem/js/types/NumberIO.js';
import StringUnionIO from '../../../../tandem/js/types/StringUnionIO.js';
Expand Down Expand Up @@ -81,7 +82,8 @@ export default class PhotonsExperimentSceneModel {
this.particleBehaviorModeProperty = new Property( 'classical', {
tandem: providedOptions.tandem.createTandem( 'particleBehaviorModeProperty' ),
phetioValueType: StringUnionIO( SystemTypeValues ),
validValues: SystemTypeValues
validValues: SystemTypeValues,
phetioFeatured: true
} );

this.particleBehaviorModeProperty.link( () => {
Expand Down Expand Up @@ -186,7 +188,12 @@ export default class PhotonsExperimentSceneModel {

// Create the Property that will be used to control whether the simulation is playing.
this.isPlayingProperty = new BooleanProperty( true, {
tandem: providedOptions.tandem.createTandem( 'isPlayingProperty' )

// Only give this a phet-io ID if it's a many-photon experiment. Otherwise, the model can't be paused.
tandem: providedOptions.photonEmissionMode === 'manyPhotons' ?
providedOptions.tandem.createTandem( 'isPlayingProperty' ) :
Tandem.OPT_OUT,
phetioFeatured: providedOptions.photonEmissionMode === 'manyPhotons'
} );
}

Expand Down
3 changes: 2 additions & 1 deletion js/photons/model/PhotonsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export default class PhotonsModel implements TModel {
this.experimentModeProperty = new Property<ExperimentModeType>( 'singlePhoton', {
tandem: providedOptions.tandem.createTandem( 'experimentModeProperty' ),
phetioValueType: StringUnionIO( ExperimentModeTypeValues ),
validValues: ExperimentModeTypeValues
validValues: ExperimentModeTypeValues,
phetioFeatured: true
} );
this.singlePhotonSceneModel = new PhotonsExperimentSceneModel( {
photonEmissionMode: 'singlePhoton',
Expand Down
1 change: 0 additions & 1 deletion js/photons/view/NormalizedOutcomeVectorGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export default class NormalizedOutcomeVectorGraph extends Node {
// Property that controls whether the expectation value line is visible when there is a valid expectation value.
const showExpectationLineProperty = new BooleanProperty( false, {
tandem: tandem.createTandem( 'showExpectationLineProperty' ),
phetioReadOnly: true,
phetioFeatured: true
} );

Expand Down
6 changes: 4 additions & 2 deletions js/photons/view/PhotonsExperimentSceneView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export default class PhotonsExperimentSceneView extends Node {
const photonPolarizationAngleControl = new PhotonPolarizationAngleControl( model.laser, {
left: INSET,
top: polarizationIndicator.bottom + 10,
tandem: providedOptions.tandem.createTandem( 'photonPolarizationAngleControl' )
tandem: providedOptions.tandem.createTandem( 'photonPolarizationAngleControl' ),
phetioFeatured: true
}
);

Expand Down Expand Up @@ -102,7 +103,8 @@ export default class PhotonsExperimentSceneView extends Node {
model.horizontalPolarizationDetector.detectionRateProperty;

const equationsBox = new PhotonsEquationNode( verticalValueProperty, horizontalValueProperty, {
tandem: providedOptions.tandem.createTandem( 'equationsBox' )
tandem: providedOptions.tandem.createTandem( 'equationsBox' ),
phetioFeatured: true
} );

// Put the title and the equations together in a vertical box.
Expand Down

0 comments on commit e66e8a2

Please sign in to comment.