diff --git a/js/common/view/BondDipolesCheckbox.js b/js/common/view/BondDipolesCheckbox.js index f87238d..98a913d 100644 --- a/js/common/view/BondDipolesCheckbox.js +++ b/js/common/view/BondDipolesCheckbox.js @@ -16,7 +16,7 @@ import moleculePolarity from '../../moleculePolarity.js'; import moleculePolarityStrings from '../../moleculePolarityStrings.js'; import BondDipoleNode from './BondDipoleNode.js'; -class BondDipolesCheckbox extends Checkbox { +export default class BondDipolesCheckbox extends Checkbox { /** * @param {Property.} bondDipolesVisibleProperty @@ -30,42 +30,25 @@ class BondDipolesCheckbox extends Checkbox { tandem: Tandem.REQUIRED }, options ); - const labelNode = createLabelNode( { - singular: options.singular, - tandem: options.tandem.createTandem( 'labelNode' ) - } ); - - super( bondDipolesVisibleProperty, labelNode, options ); - } -} - -/** - * Creates the label for this checkbox. - * @param {Object} [options] - * @returns {HBox} - */ -function createLabelNode( options ) { - - options = merge( { - singular: false, - spacing: MPConstants.CONTROL_ICON_X_SPACING, - tandem: Tandem.REQUIRED - }, options ); + const stringProperty = options.singular ? + moleculePolarityStrings.bondDipolesStringProperty : + moleculePolarityStrings.bondDipoleStringProperty; - const labelString = options.singular ? moleculePolarityStrings.bondDipole : moleculePolarityStrings.bondDipoles; - const labelText = new Text( labelString, - merge( { - tandem: options.tandem.createTandem( 'labelText' ) - }, MPConstants.CONTROL_TEXT_OPTIONS ) - ); + const textNode = new Text( stringProperty, + merge( { + tandem: options.tandem.createTandem( 'textNode' ) + }, MPConstants.CONTROL_TEXT_OPTIONS ) + ); - const labelIcon = BondDipoleNode.createIcon(); + const iconNode = BondDipoleNode.createIcon(); - assert && assert( !options.children, 'createLabelNode sets children' ); - options.children = [ labelText, labelIcon ]; + const content = new HBox( { + children: [ textNode, iconNode ], + spacing: MPConstants.CONTROL_ICON_X_SPACING + } ); - return new HBox( options ); + super( bondDipolesVisibleProperty, content, options ); + } } -moleculePolarity.register( 'BondDipolesCheckbox', BondDipolesCheckbox ); -export default BondDipolesCheckbox; \ No newline at end of file +moleculePolarity.register( 'BondDipolesCheckbox', BondDipolesCheckbox ); \ No newline at end of file diff --git a/js/molecule-polarity-main.js b/js/molecule-polarity-main.js index 8d3ada3..106deaa 100644 --- a/js/molecule-polarity-main.js +++ b/js/molecule-polarity-main.js @@ -24,7 +24,7 @@ simLauncher.launch( () => { new RealMoleculesScreen( { tandem: Tandem.ROOT.createTandem( 'realMoleculesScreen' ) } ) ]; - const sim = new Sim( moleculePolarityStrings[ 'molecule-polarity' ].title, screens, { + const sim = new Sim( moleculePolarityStrings[ 'molecule-polarity' ].titleStringProperty, screens, { preferencesModel: new PreferencesModel( { generalOptions: { customPreferences: [ { diff --git a/js/molecule-polarity-phet-io-overrides.js b/js/molecule-polarity-phet-io-overrides.js index 6623f46..765d647 100644 --- a/js/molecule-polarity-phet-io-overrides.js +++ b/js/molecule-polarity-phet-io-overrides.js @@ -73,9 +73,6 @@ window.phet.preloads.phetio.phetioElementsOverrides = "moleculePolarity.threeAtomsScreen.view.controlPanel.separator1.visibleProperty": { "phetioFeatured": true }, - "moleculePolarity.threeAtomsScreen.view.controlPanel.viewControls.bondDipolesCheckbox.labelNode.labelText.textProperty": { - "phetioFeatured": true - }, "moleculePolarity.threeAtomsScreen.view.controlPanel.viewControls.molecularDipoleCheckbox.labelNode.labelText.textProperty": { "phetioFeatured": true }, @@ -202,9 +199,6 @@ window.phet.preloads.phetio.phetioElementsOverrides = "moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.bondCharacterCheckbox.labelText.textProperty": { "phetioFeatured": true }, - "moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.bondDipoleCheckbox.labelNode.labelText.textProperty": { - "phetioFeatured": true - }, "moleculePolarity.twoAtomsScreen.view.controlPanel.viewControls.partialChargesCheckbox.labelText.textProperty": { "phetioFeatured": true },