From a21486c74e66007506306089b7c14ecf423d1898 Mon Sep 17 00:00:00 2001 From: pixelzoom Date: Fri, 2 Sep 2022 09:16:14 -0600 Subject: [PATCH] use tandem name '*Text' consistently for Text nodes, https://github.com/phetsims/natural-selection/issues/323 --- js/common/view/AddMutationsPanel.js | 20 +++++++++---------- js/common/view/GraphChoiceRadioButtonGroup.js | 8 ++++---- js/common/view/LimitedFoodCheckbox.js | 6 +++--- js/common/view/MutationComingNode.js | 6 +++--- js/common/view/PlayButtonGroup.js | 2 +- js/common/view/ToughFoodCheckbox.js | 6 +++--- js/common/view/WolvesCheckbox.js | 6 +++--- js/common/view/pedigree/PedigreeBunnyNode.js | 20 +++++++++---------- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/js/common/view/AddMutationsPanel.js b/js/common/view/AddMutationsPanel.js index 5bcbb469..024ebb65 100644 --- a/js/common/view/AddMutationsPanel.js +++ b/js/common/view/AddMutationsPanel.js @@ -60,16 +60,16 @@ class AddMutationsPanel extends NaturalSelectionPanel { // Individual column headings const mutationIconNode = new MutationIconNode(); - const dominantColumnLabel = new Text( naturalSelectionStrings.dominantStringProperty, { + const dominantColumnText = new Text( naturalSelectionStrings.dominantStringProperty, { font: NaturalSelectionConstants.ADD_MUTATION_COLUMN_HEADING_FONT, maxWidth: 60, // determined empirically - tandem: options.tandem.createTandem( 'dominantColumnLabel' ), + tandem: options.tandem.createTandem( 'dominantColumnText' ), phetioVisiblePropertyInstrumented: false } ); - const recessiveColumnLabel = new Text( naturalSelectionStrings.recessiveStringProperty, { + const recessiveColumnText = new Text( naturalSelectionStrings.recessiveStringProperty, { font: NaturalSelectionConstants.ADD_MUTATION_COLUMN_HEADING_FONT, maxWidth: 60, // determined empirically - tandem: options.tandem.createTandem( 'recessiveColumnLabel' ), + tandem: options.tandem.createTandem( 'recessiveColumnText' ), phetioVisiblePropertyInstrumented: false } ); @@ -78,8 +78,8 @@ class AddMutationsPanel extends NaturalSelectionPanel { spacing: COLUMN_SPACING, children: [ new AlignBox( mutationIconNode, { group: labelColumnAlignGroup, xAlign: LABEL_COLUMN_X_ALIGN } ), - new AlignBox( dominantColumnLabel, { group: buttonColumnsAlignGroup, xAlign: BUTTON_COLUMNS_X_ALIGN } ), - new AlignBox( recessiveColumnLabel, { group: buttonColumnsAlignGroup, xAlign: BUTTON_COLUMNS_X_ALIGN } ) + new AlignBox( dominantColumnText, { group: buttonColumnsAlignGroup, xAlign: BUTTON_COLUMNS_X_ALIGN } ), + new AlignBox( recessiveColumnText, { group: buttonColumnsAlignGroup, xAlign: BUTTON_COLUMNS_X_ALIGN } ) ] } ); @@ -186,13 +186,13 @@ class Row extends HBox { }, options ); // label that indicates the gene, to the left of the push buttons - const geneNameNode = new Text( gene.nameProperty, { + const geneNameText = new Text( gene.nameProperty, { font: NaturalSelectionConstants.ADD_MUTATION_GENE_FONT, maxWidth: 50, // determined empirically - tandem: options.tandem.createTandem( 'geneNameNode' ), + tandem: options.tandem.createTandem( 'geneNameText' ), phetioVisiblePropertyInstrumented: false } ); - const geneNameNodeWrapper = new AlignBox( geneNameNode, { + const geneNameTextWrapper = new AlignBox( geneNameText, { group: labelColumnAlignGroup, xAlign: LABEL_COLUMN_X_ALIGN } ); @@ -236,7 +236,7 @@ class Row extends HBox { assert && assert( !options.children, 'Row sets children' ); options.children = [ - geneNameNodeWrapper, + geneNameTextWrapper, new Node( { children: [ new AlignBox( dominantAlleleIcon, alignBoxOptions ), diff --git a/js/common/view/GraphChoiceRadioButtonGroup.js b/js/common/view/GraphChoiceRadioButtonGroup.js index 51c63525..d13e9c4b 100644 --- a/js/common/view/GraphChoiceRadioButtonGroup.js +++ b/js/common/view/GraphChoiceRadioButtonGroup.js @@ -51,7 +51,7 @@ class GraphChoiceRadioButtonGroup extends VerticalAquaRadioButtonGroup { { value: GraphChoice.POPULATION, createNode: tandem => new Text( naturalSelectionStrings.populationStringProperty, merge( { - tandem: tandem.createTandem( 'textNode' ) + tandem: tandem.createTandem( 'labelText' ) }, TEXT_OPTIONS ) ), tandemName: 'populationRadioButton' }, @@ -60,7 +60,7 @@ class GraphChoiceRadioButtonGroup extends VerticalAquaRadioButtonGroup { { value: GraphChoice.PROPORTIONS, createNode: tandem => new Text( naturalSelectionStrings.proportionsStringProperty, merge( { - tandem: tandem.createTandem( 'textNode' ) + tandem: tandem.createTandem( 'labelText' ) }, TEXT_OPTIONS ) ), tandemName: 'proportionsRadioButton' }, @@ -69,7 +69,7 @@ class GraphChoiceRadioButtonGroup extends VerticalAquaRadioButtonGroup { { value: GraphChoice.PEDIGREE, createNode: tandem => new Text( naturalSelectionStrings.pedigreeStringProperty, merge( { - tandem: tandem.createTandem( 'textNode' ) + tandem: tandem.createTandem( 'labelText' ) }, TEXT_OPTIONS ) ), tandemName: 'pedigreeRadioButton' }, @@ -78,7 +78,7 @@ class GraphChoiceRadioButtonGroup extends VerticalAquaRadioButtonGroup { { value: GraphChoice.NONE, createNode: tandem => new Text( naturalSelectionStrings.noneStringProperty, merge( { - tandem: tandem.createTandem( 'textNode' ) + tandem: tandem.createTandem( 'labelText' ) }, TEXT_OPTIONS ) ), tandemName: 'noneRadioButton' } diff --git a/js/common/view/LimitedFoodCheckbox.js b/js/common/view/LimitedFoodCheckbox.js index c2f76d82..10b5b178 100644 --- a/js/common/view/LimitedFoodCheckbox.js +++ b/js/common/view/LimitedFoodCheckbox.js @@ -38,14 +38,14 @@ class LimitedFoodCheckbox extends EnvironmentalFactorCheckbox { tandem: Tandem.REQUIRED }, options ); - const textNode = new Text( naturalSelectionStrings.limitedFoodStringProperty, { + const labelText = new Text( naturalSelectionStrings.limitedFoodStringProperty, { font: NaturalSelectionConstants.CHECKBOX_FONT, maxWidth: 150, // determined empirically - tandem: options.tandem.createTandem( 'textNode' ), + tandem: options.tandem.createTandem( 'labelText' ), phetioVisiblePropertyInstrumented: false } ); - super( limitedFoodProperty, textNode, alignGroup, options ); + super( limitedFoodProperty, labelText, alignGroup, options ); } } diff --git a/js/common/view/MutationComingNode.js b/js/common/view/MutationComingNode.js index 1a27b1ea..b2700f4e 100644 --- a/js/common/view/MutationComingNode.js +++ b/js/common/view/MutationComingNode.js @@ -41,16 +41,16 @@ class MutationComingNode extends Node { listener: () => gene.cancelMutation() } ); - const textNode = new Text( naturalSelectionStrings.mutationComingStringProperty, { + const labelText = new Text( naturalSelectionStrings.mutationComingStringProperty, { font: NaturalSelectionConstants.MUTATION_COMING_FONT, maxWidth: 128, // determined empirically - tandem: options.tandem.createTandem( 'textNode' ), + tandem: options.tandem.createTandem( 'labelText' ), phetioVisiblePropertyInstrumented: false } ); const hBox = new HBox( { spacing: 6, - children: [ cancelButton, textNode ] + children: [ cancelButton, labelText ] } ); const backgroundWidth = hBox.width + 2 * X_MARGIN; diff --git a/js/common/view/PlayButtonGroup.js b/js/common/view/PlayButtonGroup.js index a4f60dd1..3f560617 100644 --- a/js/common/view/PlayButtonGroup.js +++ b/js/common/view/PlayButtonGroup.js @@ -159,7 +159,7 @@ class TextPushButton extends RectangularPushButton { assert && assert( !options.content, 'TextPushButton sets content' ); assert && assert( !options.textOptions.tandem, 'TextPushButton sets textOptions.tandem' ); options.content = new Text( stringProperty, merge( {}, options.textOptions, { - tandem: options.tandem.createTandem( 'textNode' ) + tandem: options.tandem.createTandem( 'labelText' ) } ) ); super( options ); diff --git a/js/common/view/ToughFoodCheckbox.js b/js/common/view/ToughFoodCheckbox.js index 27b91d74..0f8753e2 100644 --- a/js/common/view/ToughFoodCheckbox.js +++ b/js/common/view/ToughFoodCheckbox.js @@ -39,10 +39,10 @@ class ToughFoodCheckbox extends EnvironmentalFactorCheckbox { tandem: Tandem.REQUIRED }, options ); - const textNode = new Text( naturalSelectionStrings.toughFoodStringProperty, { + const labelText = new Text( naturalSelectionStrings.toughFoodStringProperty, { font: NaturalSelectionConstants.CHECKBOX_FONT, maxWidth: 110, // determined empirically - tandem: options.tandem.createTandem( 'textNode' ), + tandem: options.tandem.createTandem( 'labelText' ), phetioVisiblePropertyInstrumented: false } ); @@ -51,7 +51,7 @@ class ToughFoodCheckbox extends EnvironmentalFactorCheckbox { } ); const labelNode = new HBox( { - children: [ textNode, icon ], + children: [ labelText, icon ], spacing: NaturalSelectionConstants.CHECKBOX_X_SPACING } ); diff --git a/js/common/view/WolvesCheckbox.js b/js/common/view/WolvesCheckbox.js index b2a9ff4c..c3a89d39 100644 --- a/js/common/view/WolvesCheckbox.js +++ b/js/common/view/WolvesCheckbox.js @@ -39,10 +39,10 @@ class WolvesCheckbox extends EnvironmentalFactorCheckbox { tandem: Tandem.REQUIRED }, options ); - const textNode = new Text( naturalSelectionStrings.wolvesStringProperty, { + const labelText = new Text( naturalSelectionStrings.wolvesStringProperty, { font: NaturalSelectionConstants.CHECKBOX_FONT, maxWidth: 110, // determined empirically - tandem: options.tandem.createTandem( 'textNode' ), + tandem: options.tandem.createTandem( 'labelText' ), phetioVisiblePropertyInstrumented: false } ); @@ -51,7 +51,7 @@ class WolvesCheckbox extends EnvironmentalFactorCheckbox { icon.setScaleMagnitude( -scale, scale ); // reflect so the wolf is facing left const labelNode = new HBox( { - children: [ textNode, icon ], + children: [ labelText, icon ], spacing: NaturalSelectionConstants.CHECKBOX_X_SPACING } ); diff --git a/js/common/view/pedigree/PedigreeBunnyNode.js b/js/common/view/pedigree/PedigreeBunnyNode.js index 2be5c97b..6f3e9eb8 100644 --- a/js/common/view/pedigree/PedigreeBunnyNode.js +++ b/js/common/view/pedigree/PedigreeBunnyNode.js @@ -72,7 +72,7 @@ class PedigreeBunnyNode extends Node { // Update the genotype abbreviation, must be disposed // Not instrumented because we decided not to instrument PedigreeBunnyNode. - const genotypeNodeDerivedStringProperty = new DerivedProperty( + const genotypeDerivedStringProperty = new DerivedProperty( [ furAllelesVisibleProperty, earsAllelesVisibleProperty, teethAllelesVisibleProperty, ...bunny.genotype.getAbbreviationStringDependencies() @@ -82,7 +82,7 @@ class PedigreeBunnyNode extends Node { ); // Must be disposed - const genotypeNodeVisibleProperty = new DerivedProperty( + const genotypeTextVisibleProperty = new DerivedProperty( [ furAllelesVisibleProperty, earsAllelesVisibleProperty, teethAllelesVisibleProperty ], ( furAllelesVisible, earsAllelesVisible, teethAllelesVisible ) => ( furAllelesVisible || earsAllelesVisible || teethAllelesVisible ) @@ -90,17 +90,17 @@ class PedigreeBunnyNode extends Node { // Genotype abbreviation // Not instrumented because we decided not to instrument PedigreeBunnyNode. - const genotypeNode = new Text( genotypeNodeDerivedStringProperty, { - visibleProperty: genotypeNodeVisibleProperty, + const genotypeText = new Text( genotypeDerivedStringProperty, { + visibleProperty: genotypeTextVisibleProperty, font: GENOTYPE_FONT, maxWidth: bunnyNode.width } ); - children.push( genotypeNode ); + children.push( genotypeText ); // Center the genotype abbreviation above the bunny. - genotypeNode.boundsProperty.link( () => { - genotypeNode.centerX = bunnyNode.centerX; - genotypeNode.top = bunnyNode.bottom + 5; + genotypeText.boundsProperty.link( () => { + genotypeText.centerX = bunnyNode.centerX; + genotypeText.top = bunnyNode.bottom + 5; } ); // Optional selection rectangle, prepended to children @@ -139,8 +139,8 @@ class PedigreeBunnyNode extends Node { // @private {function} this.disposePedigreeBunnyNode = () => { - genotypeNodeDerivedStringProperty.dispose(); - genotypeNodeVisibleProperty.dispose(); + genotypeDerivedStringProperty.dispose(); + genotypeTextVisibleProperty.dispose(); if ( bunny.diedEmitter.hasListener( addRedCrossMark ) ) { bunny.diedEmitter.removeListener( addRedCrossMark ); }