diff --git a/js/common/model/BlockSetModel.js b/js/common/model/BlockSetModel.js index 2fa22243..dd3d31ab 100644 --- a/js/common/model/BlockSetModel.js +++ b/js/common/model/BlockSetModel.js @@ -32,7 +32,7 @@ const BlockSetModel = ( type, BlockSet, initialMode ) => { // @public {Property.} this.blockSetProperty = new EnumerationProperty( BlockSet, initialMode, { - tandem: tandem.createTandem( 'blockSetProperty' ) + tandem: tandem.createTandem( 'blockSets' ).createTandem( 'blockSetProperty' ) } ); // @private diff --git a/js/common/view/SecondMassVisibleControl.js b/js/common/view/BlocksRadioButtonGroup.js similarity index 89% rename from js/common/view/SecondMassVisibleControl.js rename to js/common/view/BlocksRadioButtonGroup.js index 37c346ab..56721d42 100644 --- a/js/common/view/SecondMassVisibleControl.js +++ b/js/common/view/BlocksRadioButtonGroup.js @@ -30,7 +30,7 @@ DensityBuoyancyCommonColors.labelBProperty.link( labelColor => { bMaterial.color = ThreeUtils.colorToThree( labelColor ); } ); -class SecondMassVisibleControl extends RectangularRadioButtonGroup { +class BlocksRadioButtonGroup extends RectangularRadioButtonGroup { /** * @param {Property.} secondaryMassVisibleProperty * @param {Object} [options] @@ -39,12 +39,12 @@ class SecondMassVisibleControl extends RectangularRadioButtonGroup { super( secondaryMassVisibleProperty, [ { value: false, - node: SecondMassVisibleControl.getSingleCuboidIcon(), + node: BlocksRadioButtonGroup.getSingleCuboidIcon(), tandemName: 'oneBlockRadioButton' }, { value: true, - node: SecondMassVisibleControl.getDoubleCuboidIcon(), + node: BlocksRadioButtonGroup.getDoubleCuboidIcon(), tandemName: 'twoBlocksRadioButton' } ], merge( { @@ -165,8 +165,8 @@ class SecondMassVisibleControl extends RectangularRadioButtonGroup { */ static getSingleCuboidIcon() { if ( DensityBuoyancyCommonQueryParameters.generateIconImages ) { - return SecondMassVisibleControl.getIcon( 5.5, scene => { - scene.add( SecondMassVisibleControl.createBox( aMaterial, new Vector3( 0, 0, 0 ) ) ); + return BlocksRadioButtonGroup.getIcon( 5.5, scene => { + scene.add( BlocksRadioButtonGroup.createBox( aMaterial, new Vector3( 0, 0, 0 ) ) ); } ); } else { @@ -182,9 +182,9 @@ class SecondMassVisibleControl extends RectangularRadioButtonGroup { */ static getDoubleCuboidIcon() { if ( DensityBuoyancyCommonQueryParameters.generateIconImages ) { - return SecondMassVisibleControl.getIcon( 4, scene => { - scene.add( SecondMassVisibleControl.createBox( aMaterial, new Vector3( -0.039, 0.015, -0.07 ) ) ); - scene.add( SecondMassVisibleControl.createBox( bMaterial, new Vector3( 0.03, -0.005, 0.07 ) ) ); + return BlocksRadioButtonGroup.getIcon( 4, scene => { + scene.add( BlocksRadioButtonGroup.createBox( aMaterial, new Vector3( -0.039, 0.015, -0.07 ) ) ); + scene.add( BlocksRadioButtonGroup.createBox( bMaterial, new Vector3( 0.03, -0.005, 0.07 ) ) ); } ); } else { @@ -193,5 +193,5 @@ class SecondMassVisibleControl extends RectangularRadioButtonGroup { } } -densityBuoyancyCommon.register( 'SecondMassVisibleControl', SecondMassVisibleControl ); -export default SecondMassVisibleControl; \ No newline at end of file +densityBuoyancyCommon.register( 'BlocksRadioButtonGroup', BlocksRadioButtonGroup ); +export default BlocksRadioButtonGroup; \ No newline at end of file diff --git a/js/common/view/PrimarySecondaryControlsNode.js b/js/common/view/PrimarySecondaryControlsNode.js index b08f8603..7d0d9077 100644 --- a/js/common/view/PrimarySecondaryControlsNode.js +++ b/js/common/view/PrimarySecondaryControlsNode.js @@ -30,13 +30,13 @@ class PrimarySecondaryControlsNode extends PrimarySecondaryPanelsNode { labelNode: PrimarySecondaryPanelsNode.getPrimaryLabelNode(), color: DensityBuoyancyCommonColors.labelAProperty, visibleProperty: primaryMass.visibleProperty, - tandem: tandem.createTandem( 'primaryBlockControlNode' ) + tandem: tandem.createTandem( 'blockAControlPanel' ) }, omittedOptions ) ), new BlockControlNode( secondaryMass, popupLayer, merge( { labelNode: PrimarySecondaryPanelsNode.getSecondaryLabelNode(), color: DensityBuoyancyCommonColors.labelBProperty, visibleProperty: secondaryMass.visibleProperty, - tandem: tandem.createTandem( 'secondaryBlockControlNode' ) + tandem: tandem.createTandem( 'blockBControlPanel' ) }, omittedOptions ) ) ); } diff --git a/js/common/view/SecondaryMassScreenView.js b/js/common/view/SecondaryMassScreenView.js index 7ca41ee6..5c9c4722 100644 --- a/js/common/view/SecondaryMassScreenView.js +++ b/js/common/view/SecondaryMassScreenView.js @@ -8,8 +8,8 @@ import Vector3 from '../../../../dot/js/Vector3.js'; import densityBuoyancyCommon from '../../densityBuoyancyCommon.js'; +import BlocksRadioButtonGroup from './BlocksRadioButtonGroup.js'; import DensityBuoyancyScreenView from './DensityBuoyancyScreenView.js'; -import SecondMassVisibleControl from './SecondMassVisibleControl.js'; class SecondaryMassScreenView extends DensityBuoyancyScreenView { /** @@ -22,11 +22,11 @@ class SecondaryMassScreenView extends DensityBuoyancyScreenView { assert && assert( this.rightBox, 'SecondaryMassScreenView requires a this.rightBox be defined to add this control' ); // @private {Node} - this.secondMassVisibleControl = new SecondMassVisibleControl( secondaryMassVisibleProperty, { - tandem: this.tandem.createTandem( 'secondMassVisibleControl' ) + this.blocksRadioButtonGroup = new BlocksRadioButtonGroup( secondaryMassVisibleProperty, { + tandem: this.tandem.createTandem( 'blocksRadioButtonGroup' ) } ); - this.addChild( this.secondMassVisibleControl ); + this.addChild( this.blocksRadioButtonGroup ); // This instance lives for the lifetime of the simulation, so we don't need to remove this listener this.rightBox.transformEmitter.addListener( () => this.positionSecondMassControl() ); @@ -38,12 +38,12 @@ class SecondaryMassScreenView extends DensityBuoyancyScreenView { * @private */ positionSecondMassControl() { - this.secondMassVisibleControl.bottom = this.modelToViewPoint( new Vector3( + this.blocksRadioButtonGroup.bottom = this.modelToViewPoint( new Vector3( 0, this.model.poolBounds.minY, this.model.poolBounds.maxZ ) ).y; - this.secondMassVisibleControl.left = this.rightBox.left; + this.blocksRadioButtonGroup.left = this.rightBox.left; } /** diff --git a/js/density/model/DensityExploreModel.js b/js/density/model/DensityExploreModel.js index 71084e5e..0f4c0959 100644 --- a/js/density/model/DensityExploreModel.js +++ b/js/density/model/DensityExploreModel.js @@ -28,15 +28,17 @@ class DensityExploreModel extends DensityBuoyancyModel { canShowForces: false }, options ) ); + const blocksTandem = tandem.createTandem( 'blocks' ); + // @public (read-only) {Mass} this.primaryMass = Cuboid.createWithMass( this.engine, Material.WOOD, new Vector2( -0.2, 0.2 ), 2, { tag: Mass.MassTag.PRIMARY, - tandem: tandem.createTandem( 'primaryMass' ) + tandem: blocksTandem.createTandem( 'blockA' ) } ); this.availableMasses.push( this.primaryMass ); this.secondaryMass = Cuboid.createWithMass( this.engine, Material.ALUMINUM, new Vector2( -0.2, 0.35 ), 13.5, { tag: Mass.MassTag.SECONDARY, - tandem: tandem.createTandem( 'secondaryMass' ), + tandem: blocksTandem.createTandem( 'blockB' ), visible: false } ); this.availableMasses.push( this.secondaryMass ); diff --git a/js/density/model/DensityIntroModel.js b/js/density/model/DensityIntroModel.js index 870edb3b..5a996e6b 100644 --- a/js/density/model/DensityIntroModel.js +++ b/js/density/model/DensityIntroModel.js @@ -34,9 +34,10 @@ class DensityIntroModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, B const tandem = options.tandem; - const sameMassTandem = tandem.createTandem( 'sameMass' ); - const sameVolumeTandem = tandem.createTandem( 'sameVolume' ); - const sameDensityTandem = tandem.createTandem( 'sameDensity' ); + const blockSetsTandem = tandem.createTandem( 'blockSets' ); + const sameMassTandem = blockSetsTandem.createTandem( 'sameMass' ); + const sameVolumeTandem = blockSetsTandem.createTandem( 'sameVolume' ); + const sameDensityTandem = blockSetsTandem.createTandem( 'sameDensity' ); const massProperty = new NumberProperty( 5, { range: new Range( 1, 10 ), @@ -64,22 +65,22 @@ class DensityIntroModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, B Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 500, customColor: DensityBuoyancyCommonColors.comparingYellowColorProperty - } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'yellowMass' ) } ), + } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'yellowBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 1000, customColor: DensityBuoyancyCommonColors.comparingBlueColorProperty - } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'blueMass' ) } ), + } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'blueBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 2000, customColor: DensityBuoyancyCommonColors.comparingGreenColorProperty - } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'greenMass' ) } ), + } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'greenBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 4000, customColor: DensityBuoyancyCommonColors.comparingRedColorProperty - } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'redMass' ) } ) + } ), Vector2.ZERO, 5, { tandem: sameMassTandem.createTandem( 'redBlock' ) } ) ]; // This instance lives for the lifetime of the simulation, so we don't need to remove this listener @@ -97,22 +98,22 @@ class DensityIntroModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, B Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 1600, customColor: DensityBuoyancyCommonColors.comparingYellowColorProperty - } ), Vector2.ZERO, 8, { tandem: sameVolumeTandem.createTandem( 'yellowMass' ) } ), + } ), Vector2.ZERO, 8, { tandem: sameVolumeTandem.createTandem( 'yellowBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 1200, customColor: DensityBuoyancyCommonColors.comparingBlueColorProperty - } ), Vector2.ZERO, 6, { tandem: sameVolumeTandem.createTandem( 'blueMass' ) } ), + } ), Vector2.ZERO, 6, { tandem: sameVolumeTandem.createTandem( 'blueBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 800, customColor: DensityBuoyancyCommonColors.comparingGreenColorProperty - } ), Vector2.ZERO, 4, { tandem: sameVolumeTandem.createTandem( 'greenMass' ) } ), + } ), Vector2.ZERO, 4, { tandem: sameVolumeTandem.createTandem( 'greenBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 400, customColor: DensityBuoyancyCommonColors.comparingRedColorProperty - } ), Vector2.ZERO, 2, { tandem: sameVolumeTandem.createTandem( 'redMass' ) } ) + } ), Vector2.ZERO, 2, { tandem: sameVolumeTandem.createTandem( 'redBlock' ) } ) ]; // This instance lives for the lifetime of the simulation, so we don't need to remove this listener @@ -133,22 +134,22 @@ class DensityIntroModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, B Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 500, customColor: DensityBuoyancyCommonColors.comparingYellowColorProperty - } ), Vector2.ZERO, 3, { tandem: sameDensityTandem.createTandem( 'yellowMass' ) } ), + } ), Vector2.ZERO, 3, { tandem: sameDensityTandem.createTandem( 'yellowBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 500, customColor: DensityBuoyancyCommonColors.comparingBlueColorProperty - } ), Vector2.ZERO, 2, { tandem: sameDensityTandem.createTandem( 'blueMass' ) } ), + } ), Vector2.ZERO, 2, { tandem: sameDensityTandem.createTandem( 'blueBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 500, customColor: DensityBuoyancyCommonColors.comparingGreenColorProperty - } ), Vector2.ZERO, 1, { tandem: sameDensityTandem.createTandem( 'greenMass' ) } ), + } ), Vector2.ZERO, 1, { tandem: sameDensityTandem.createTandem( 'greenBlock' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 500, customColor: DensityBuoyancyCommonColors.comparingRedColorProperty - } ), Vector2.ZERO, 0.5, { tandem: sameDensityTandem.createTandem( 'redMass' ) } ) + } ), Vector2.ZERO, 0.5, { tandem: sameDensityTandem.createTandem( 'redBlock' ) } ) ]; // This instance lives for the lifetime of the simulation, so we don't need to remove this listener diff --git a/js/density/model/DensityMysteryModel.js b/js/density/model/DensityMysteryModel.js index 6e1ba508..bf414a85 100644 --- a/js/density/model/DensityMysteryModel.js +++ b/js/density/model/DensityMysteryModel.js @@ -87,10 +87,11 @@ class DensityMysteryModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, ].sort(); }; - const set1Tandem = tandem.createTandem( 'set1' ); - const set2Tandem = tandem.createTandem( 'set2' ); - const set3Tandem = tandem.createTandem( 'set3' ); - const randomTandem = tandem.createTandem( 'random' ); + const blockSetsTandem = tandem.createTandem( 'blockSets' ); + const set1Tandem = blockSetsTandem.createTandem( 'set1' ); + const set2Tandem = blockSetsTandem.createTandem( 'set2' ); + const set3Tandem = blockSetsTandem.createTandem( 'set3' ); + const randomTandem = blockSetsTandem.createTandem( 'random' ); const createMasses = ( model, blockSet ) => { switch( blockSet ) { @@ -99,81 +100,81 @@ class DensityMysteryModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.WATER.density, customColor: DensityBuoyancyCommonColors.comparingRedColorProperty - } ), Vector2.ZERO, 0.005, { tag: Mass.MassTag.ONE_D, tandem: set1Tandem.createTandem( '1D' ) } ), + } ), Vector2.ZERO, 0.005, { tag: Mass.MassTag.ONE_D, tandem: set1Tandem.createTandem( 'block1D' ) } ), Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.WOOD.density, customColor: DensityBuoyancyCommonColors.comparingBlueColorProperty - } ), Vector2.ZERO, 0.001, { tag: Mass.MassTag.ONE_B, tandem: set1Tandem.createTandem( '1B' ) } ), + } ), Vector2.ZERO, 0.001, { tag: Mass.MassTag.ONE_B, tandem: set1Tandem.createTandem( 'block1B' ) } ), Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.WOOD.density, customColor: DensityBuoyancyCommonColors.comparingGreenColorProperty - } ), Vector2.ZERO, 0.007, { tag: Mass.MassTag.ONE_E, tandem: set1Tandem.createTandem( '1E' ) } ), + } ), Vector2.ZERO, 0.007, { tag: Mass.MassTag.ONE_E, tandem: set1Tandem.createTandem( 'block1E' ) } ), Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.GOLD.density, customColor: DensityBuoyancyCommonColors.comparingYellowColorProperty - } ), Vector2.ZERO, 0.001, { tag: Mass.MassTag.ONE_C, tandem: set1Tandem.createTandem( '1C' ) } ), + } ), Vector2.ZERO, 0.001, { tag: Mass.MassTag.ONE_C, tandem: set1Tandem.createTandem( 'block1C' ) } ), Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.DIAMOND.density, customColor: DensityBuoyancyCommonColors.comparingPurpleColorProperty - } ), Vector2.ZERO, 0.0055, { tag: Mass.MassTag.ONE_A, tandem: set1Tandem.createTandem( '1A' ) } ) + } ), Vector2.ZERO, 0.0055, { tag: Mass.MassTag.ONE_A, tandem: set1Tandem.createTandem( 'block1A' ) } ) ]; case BlockSet.SET_2: return [ Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 4500, customColor: DensityBuoyancyCommonColors.mysteryPinkColorProperty - } ), Vector2.ZERO, 18, { tag: Mass.MassTag.TWO_D, tandem: set2Tandem.createTandem( '2D' ) } ), + } ), Vector2.ZERO, 18, { tag: Mass.MassTag.TWO_D, tandem: set2Tandem.createTandem( 'block2D' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 11340, customColor: DensityBuoyancyCommonColors.mysteryOrangeColorProperty - } ), Vector2.ZERO, 18, { tag: Mass.MassTag.TWO_A, tandem: set2Tandem.createTandem( '2A' ) } ), + } ), Vector2.ZERO, 18, { tag: Mass.MassTag.TWO_A, tandem: set2Tandem.createTandem( 'block2A' ) } ), Cuboid.createWithVolume( model.engine, Material.createCustomMaterial( { density: Material.COPPER.density, customColor: DensityBuoyancyCommonColors.mysteryLightPurpleColorProperty - } ), Vector2.ZERO, 0.005, { tag: Mass.MassTag.TWO_E, tandem: set2Tandem.createTandem( '2E' ) } ), + } ), Vector2.ZERO, 0.005, { tag: Mass.MassTag.TWO_E, tandem: set2Tandem.createTandem( 'block2E' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 2700, customColor: DensityBuoyancyCommonColors.mysteryLightGreenColorProperty - } ), Vector2.ZERO, 2.7, { tag: Mass.MassTag.TWO_C, tandem: set2Tandem.createTandem( '2C' ) } ), + } ), Vector2.ZERO, 2.7, { tag: Mass.MassTag.TWO_C, tandem: set2Tandem.createTandem( 'block2C' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 2700, customColor: DensityBuoyancyCommonColors.mysteryBrownColorProperty - } ), Vector2.ZERO, 10.8, { tag: Mass.MassTag.TWO_B, tandem: set2Tandem.createTandem( '2B' ) } ) + } ), Vector2.ZERO, 10.8, { tag: Mass.MassTag.TWO_B, tandem: set2Tandem.createTandem( 'block2B' ) } ) ]; case BlockSet.SET_3: return [ Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 950, customColor: DensityBuoyancyCommonColors.mysteryWhiteColorProperty - } ), Vector2.ZERO, 6, { tag: Mass.MassTag.THREE_E, tandem: set3Tandem.createTandem( '3E' ) } ), + } ), Vector2.ZERO, 6, { tag: Mass.MassTag.THREE_E, tandem: set3Tandem.createTandem( 'block3E' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 1000, customColor: DensityBuoyancyCommonColors.mysteryGrayColorProperty - } ), Vector2.ZERO, 6, { tag: Mass.MassTag.THREE_B, tandem: set3Tandem.createTandem( '3B' ) } ), + } ), Vector2.ZERO, 6, { tag: Mass.MassTag.THREE_B, tandem: set3Tandem.createTandem( 'block3B' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 400, customColor: DensityBuoyancyCommonColors.mysteryMustardColorProperty - } ), Vector2.ZERO, 2, { tag: Mass.MassTag.THREE_D, tandem: set3Tandem.createTandem( '3D' ) } ), + } ), Vector2.ZERO, 2, { tag: Mass.MassTag.THREE_D, tandem: set3Tandem.createTandem( 'block3D' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 7800, customColor: DensityBuoyancyCommonColors.mysteryPeachColorProperty - } ), Vector2.ZERO, 23.4, { tag: Mass.MassTag.THREE_C, tandem: set3Tandem.createTandem( '3C' ) } ), + } ), Vector2.ZERO, 23.4, { tag: Mass.MassTag.THREE_C, tandem: set3Tandem.createTandem( 'block3C' ) } ), Cuboid.createWithMass( model.engine, Material.createCustomMaterial( { density: 950, customColor: DensityBuoyancyCommonColors.mysteryMaroonColorProperty - } ), Vector2.ZERO, 2.85, { tag: Mass.MassTag.THREE_A, tandem: set3Tandem.createTandem( '3A' ) } ) + } ), Vector2.ZERO, 2.85, { tag: Mass.MassTag.THREE_A, tandem: set3Tandem.createTandem( 'block3A' ) } ) ]; case BlockSet.RANDOM: { const tags = [ @@ -190,7 +191,7 @@ class DensityMysteryModel extends BlockSetModel( DensityBuoyancyModel, BlockSet, return _.range( 0, 5 ).map( i => { return Cuboid.createWithVolume( model.engine, mysteryMaterials[ i ], Vector2.ZERO, mysteryVolumes[ i ], { tag: tags[ i ], - tandem: randomTandem.createTandem( tags[ i ].name ) + tandem: randomTandem.createTandem( `block${tags[ i ].name}` ) } ); } ); }