From 32ce9860752dab30db9d345b34c14b29a16dd1e1 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Thu, 8 Dec 2022 14:07:13 -0700 Subject: [PATCH] add validValues to prevent basics from having incorrect studio values, https://github.com/phetsims/molecule-shapes/issues/227 --- js/real/RealMoleculesModel.js | 4 +++- js/real/RealMoleculesScreenView.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/real/RealMoleculesModel.js b/js/real/RealMoleculesModel.js index 5815100..497305f 100644 --- a/js/real/RealMoleculesModel.js +++ b/js/real/RealMoleculesModel.js @@ -29,7 +29,8 @@ class RealMoleculesModel extends MoleculeShapesModel { */ constructor( isBasicsVersion, tandem ) { - const startingMoleculeShape = isBasicsVersion ? RealMoleculeShape.TAB_2_BASIC_MOLECULES[ 0 ] : RealMoleculeShape.TAB_2_MOLECULES[ 0 ]; + const validMoleculeShapes = isBasicsVersion ? RealMoleculeShape.TAB_2_BASIC_MOLECULES : RealMoleculeShape.TAB_2_MOLECULES; + const startingMoleculeShape = validMoleculeShapes[ 0 ]; const startingMolecule = new RealMolecule( startingMoleculeShape ); super( isBasicsVersion, { @@ -41,6 +42,7 @@ class RealMoleculesModel extends MoleculeShapesModel { this.realMoleculeShapeProperty = new Property( startingMoleculeShape, { tandem: tandem.createTandem( 'realMoleculeShapeProperty' ), phetioValueType: RealMoleculeShape.RealMoleculeShapeIO, + validValues: validMoleculeShapes, phetioState: false } ); diff --git a/js/real/RealMoleculesScreenView.js b/js/real/RealMoleculesScreenView.js index 2218170..a0c69ee 100644 --- a/js/real/RealMoleculesScreenView.js +++ b/js/real/RealMoleculesScreenView.js @@ -11,7 +11,6 @@ import PhetFont from '../../../scenery-phet/js/PhetFont.js'; import { AlignBox, FlowBox, Node, RichText, Text } from '../../../scenery/js/imports.js'; import AquaRadioButtonGroup from '../../../sun/js/AquaRadioButtonGroup.js'; import ComboBox from '../../../sun/js/ComboBox.js'; -import RealMoleculeShape from '../common/model/RealMoleculeShape.js'; import MoleculeView from '../common/view/3d/MoleculeView.js'; import MoleculeShapesColors from '../common/view/MoleculeShapesColors.js'; import MoleculeShapesPanel from '../common/view/MoleculeShapesPanel.js'; @@ -36,8 +35,7 @@ class RealMoleculesScreenView extends MoleculeShapesScreenView { const optionsPanelTandem = tandem.createTandem( 'optionsPanel' ); const comboBoxListContainer = new Node(); - const comboBoxMolecules = model.isBasicsVersion ? RealMoleculeShape.TAB_2_BASIC_MOLECULES : RealMoleculeShape.TAB_2_MOLECULES; - const comboBoxItems = _.map( comboBoxMolecules, realMoleculeShape => { + const comboBoxItems = _.map( model.realMoleculeShapeProperty.validValues, realMoleculeShape => { return { value: realMoleculeShape, node: new RichText( ChemUtils.toSubscript( realMoleculeShape.displayName ) ),