Skip to content

Commit

Permalink
labelText tandems for checkboxes, see #188
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Sep 30, 2021
1 parent db699e8 commit 18e56ce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
12 changes: 8 additions & 4 deletions js/common/view/GeometryNamePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,25 @@ class GeometryNamePanel extends MoleculeShapesPanel {
const textLabelFont = new PhetFont( 14 );

// @private {MoleculeShapesCheckbox}
const moleculeGeometryCheckboxTandem = tandem.createTandem( 'moleculeGeometryCheckbox' );
this.moleculeGeometryCheckbox = new MoleculeShapesCheckbox( new Text( controlMoleculeGeometryString, {
font: textLabelFont,
fill: MoleculeShapesColors.moleculeGeometryNameProperty
fill: MoleculeShapesColors.moleculeGeometryNameProperty,
tandem: moleculeGeometryCheckboxTandem.createTandem( 'labelText' )
} ), model.showMoleculeGeometryProperty, {
tandem: tandem.createTandem( 'moleculeGeometryCheckbox' ),
tandem: moleculeGeometryCheckboxTandem,
layoutOptions: {
x: 0,
y: 0
}
} );
const electronGeometryCheckboxTandem = model.isBasicsVersion ? Tandem.OPT_OUT : tandem.createTandem( 'electronGeometryCheckbox' );
this.electronGeometryCheckbox = new MoleculeShapesCheckbox( new Text( controlElectronGeometryString, {
font: textLabelFont,
fill: MoleculeShapesColors.electronGeometryNameProperty
fill: MoleculeShapesColors.electronGeometryNameProperty,
tandem: electronGeometryCheckboxTandem.createTandem( 'labelText' )
} ), model.showElectronGeometryProperty, {
tandem: model.isBasicsVersion ? Tandem.OPT_OUT : tandem.createTandem( 'electronGeometryCheckbox' ),
tandem: electronGeometryCheckboxTandem,
layoutOptions: {
x: 1,
y: 0
Expand Down
6 changes: 4 additions & 2 deletions js/common/view/GlobalOptionsNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ class GlobalOptionsNode extends VBox {
const checkboxes = [];

if ( !isBasicsVersion ) {
const showOuterLonePairsCheckboxTandem = tandem.createTandem( 'showOuterLonePairsCheckbox' );
checkboxes.push( new Checkbox( new Text( optionsShowOuterLonePairsString, {
font: OptionsDialog.DEFAULT_FONT,
maxWidth: 350
maxWidth: 350,
tandem: showOuterLonePairsCheckboxTandem.createTandem( 'labelText' )
} ),
MoleculeShapesGlobals.showOuterLonePairsProperty, {
tandem: tandem.createTandem( 'showOuterLonePairsCheckbox' )
tandem: showOuterLonePairsCheckboxTandem
} ) );
}

Expand Down
13 changes: 9 additions & 4 deletions js/common/view/OptionsNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,27 @@ class OptionsNode extends VBox {
* @param {Object} [options]
*/
constructor( model, tandem, options ) {
const showLonePairsCheckboxTandem = model.isBasicsVersion ? Tandem.OPT_OUT : tandem.createTandem( 'showLonePairsCheckbox' );
const showBondAnglesCheckboxTandem = tandem.createTandem( 'showBondAnglesCheckbox' );

const showLonePairsLabel = new Text( controlShowLonePairsString, {
font: optionsFont,
fill: MoleculeShapesColors.controlPanelTextProperty
fill: MoleculeShapesColors.controlPanelTextProperty,
tandem: showBondAnglesCheckboxTandem.createTandem( 'labelText' )
} );

const showBondAnglesLabel = new Text( controlShowBondAnglesString, {
font: optionsFont,
fill: MoleculeShapesColors.controlPanelTextProperty
fill: MoleculeShapesColors.controlPanelTextProperty,
tandem: showBondAnglesCheckboxTandem.createTandem( 'labelText' )
} );

const showLonePairsCheckbox = new MoleculeShapesCheckbox( showLonePairsLabel, model.showLonePairsProperty, {
enabledPropertyOptions: { phetioReadOnly: true },
tandem: model.isBasicsVersion ? Tandem.OPT_OUT : tandem.createTandem( 'showLonePairsCheckbox' )
tandem: showLonePairsCheckboxTandem
} );
const showBondAnglesCheckbox = new MoleculeShapesCheckbox( showBondAnglesLabel, model.showBondAnglesProperty, {
tandem: tandem.createTandem( 'showBondAnglesCheckbox' )
tandem: showBondAnglesCheckboxTandem
} );

// touch areas
Expand Down

0 comments on commit 18e56ce

Please sign in to comment.