Skip to content

Commit

Permalink
fix tandem structure for radio buttons, factor out reused options to …
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Dec 31, 2019
1 parent 4a73ffd commit f6c6b80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
13 changes: 12 additions & 1 deletion js/ISLCConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ define( require => {

// modules
const inverseSquareLawCommon = require( 'INVERSE_SQUARE_LAW_COMMON/inverseSquareLawCommon' );
const PhetFont = require( 'SCENERY_PHET/PhetFont' );

// constants
const MAX_DISTANCE_FROM_CENTER = 5; // meters, empirically determined boundary for objects
Expand All @@ -26,7 +27,17 @@ define( require => {

// mass constants
CONSTANT_RADIUS: 0.5, // meters
MASS_DENSITY: 150 // kg/m^3
MASS_DENSITY: 150, // kg/m^3

CHECKBOX_OPTIONS: {
spacing: 10,
padding: 8,
boxWidth: 16
},
UI_TEXT_OPTIONS: {
font: new PhetFont( 14 ),
maxWidth: 125
}
};

inverseSquareLawCommon.register( 'ISLCConstants', ISLCConstants );
Expand Down
24 changes: 2 additions & 22 deletions js/view/ISLCCheckboxPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ define( require => {

// modules
const inverseSquareLawCommon = require( 'INVERSE_SQUARE_LAW_COMMON/inverseSquareLawCommon' );
const ISLCConstants = require( 'INVERSE_SQUARE_LAW_COMMON/ISLCConstants' );
const ISLCPanel = require( 'INVERSE_SQUARE_LAW_COMMON/view/ISLCPanel' );
const merge = require( 'PHET_CORE/merge' );
const PhetFont = require( 'SCENERY_PHET/PhetFont' );
const Tandem = require( 'TANDEM/Tandem' );
const Text = require( 'SCENERY/nodes/Text' );
const VerticalCheckboxGroup = require( 'SUN/VerticalCheckboxGroup' );
Expand All @@ -32,7 +32,7 @@ define( require => {
options = merge( {

checkboxGroupOptions: {
checkboxOptions: ISLCCheckboxPanel.CHECKBOX_OPTIONS
checkboxOptions: ISLCConstants.CHECKBOX_OPTIONS
},
fill: '#FDF498',
xMargin: 10,
Expand All @@ -52,27 +52,7 @@ define( require => {

super( new VerticalCheckboxGroup( checkboxItems, options.checkboxGroupOptions ), options );
}

/**
* TODO: get rid of this
* @param {Tandem} tandem
* @returns {Object}
*/
static getCheckboxTextOptions( tandem ) {
return {
tandem: tandem.createTandem( 'labelNode' ),
font: new PhetFont( 14 ),
maxWidth: 125
};
}
}

// @public (read-only) for any checkboxes needed
ISLCCheckboxPanel.CHECKBOX_OPTIONS = {
spacing: 10,
padding: 8,
boxWidth: 16
};

return inverseSquareLawCommon.register( 'ISLCCheckboxPanel', ISLCCheckboxPanel );
} );

0 comments on commit f6c6b80

Please sign in to comment.