From e66e8a2981b9debb710f3fd2d0f3c7f9cb46553b Mon Sep 17 00:00:00 2001 From: jbphet Date: Fri, 13 Dec 2024 16:14:52 -0700 Subject: [PATCH] set phet-io "featured" flag for elements of screen 2, see https://github.com/phetsims/quantum-measurement/issues/63 --- js/common/model/TwoStateSystem.ts | 3 ++- js/photons/model/Laser.ts | 11 ++++++++--- js/photons/model/PhotonsExperimentSceneModel.ts | 11 +++++++++-- js/photons/model/PhotonsModel.ts | 3 ++- js/photons/view/NormalizedOutcomeVectorGraph.ts | 1 - js/photons/view/PhotonsExperimentSceneView.ts | 6 ++++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/js/common/model/TwoStateSystem.ts b/js/common/model/TwoStateSystem.ts index ca1c322..e43f86d 100644 --- a/js/common/model/TwoStateSystem.ts +++ b/js/common/model/TwoStateSystem.ts @@ -34,7 +34,8 @@ export default class TwoStateSystem 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. diff --git a/js/photons/model/Laser.ts b/js/photons/model/Laser.ts index cc6ac6e..5c87c5c 100644 --- a/js/photons/model/Laser.ts +++ b/js/photons/model/Laser.ts @@ -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( '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 } ); diff --git a/js/photons/model/PhotonsExperimentSceneModel.ts b/js/photons/model/PhotonsExperimentSceneModel.ts index a173171..903e036 100644 --- a/js/photons/model/PhotonsExperimentSceneModel.ts +++ b/js/photons/model/PhotonsExperimentSceneModel.ts @@ -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'; @@ -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( () => { @@ -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' } ); } diff --git a/js/photons/model/PhotonsModel.ts b/js/photons/model/PhotonsModel.ts index e83aa5c..a7326f5 100644 --- a/js/photons/model/PhotonsModel.ts +++ b/js/photons/model/PhotonsModel.ts @@ -63,7 +63,8 @@ export default class PhotonsModel implements TModel { this.experimentModeProperty = new Property( 'singlePhoton', { tandem: providedOptions.tandem.createTandem( 'experimentModeProperty' ), phetioValueType: StringUnionIO( ExperimentModeTypeValues ), - validValues: ExperimentModeTypeValues + validValues: ExperimentModeTypeValues, + phetioFeatured: true } ); this.singlePhotonSceneModel = new PhotonsExperimentSceneModel( { photonEmissionMode: 'singlePhoton', diff --git a/js/photons/view/NormalizedOutcomeVectorGraph.ts b/js/photons/view/NormalizedOutcomeVectorGraph.ts index 3e3713d..4f63334 100644 --- a/js/photons/view/NormalizedOutcomeVectorGraph.ts +++ b/js/photons/view/NormalizedOutcomeVectorGraph.ts @@ -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 } ); diff --git a/js/photons/view/PhotonsExperimentSceneView.ts b/js/photons/view/PhotonsExperimentSceneView.ts index d9bf7d7..feefec0 100644 --- a/js/photons/view/PhotonsExperimentSceneView.ts +++ b/js/photons/view/PhotonsExperimentSceneView.ts @@ -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 } ); @@ -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.