Skip to content

Commit

Permalink
added tandems for common code components that already support them, see
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 15, 2016
1 parent 4072041 commit b2673f3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
4 changes: 2 additions & 2 deletions js/gravity-force-lab/view/GravityForceLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ define( function( require ) {

var resetAllButton = new ResetAllButton( {
listener: function() { model.reset(); },
scale: 0.81
scale: 0.81,
tandem: tandem.createTandem( 'resetAllButton' )
} );
this.addChild( resetAllButton );

Expand All @@ -110,7 +111,6 @@ define( function( require ) {
model.mass1.baseColorProperty.get(),
tandem.createTandem( 'massControl1' )
);

massControl1.scale( CONTROL_SCALE );
this.addChild( massControl1 );

Expand Down
7 changes: 4 additions & 3 deletions js/gravity-force-lab/view/MassControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ define( function( require ) {
// modules
var Dimension2 = require( 'DOT/Dimension2' );
var gravityForceLab = require( 'GRAVITY_FORCE_LAB/gravityForceLab' );
var GravityForceLabConstants = require( 'GRAVITY_FORCE_LAB/gravity-force-lab/GravityForceLabConstants' );
var inherit = require( 'PHET_CORE/inherit' );
var Panel = require( 'SUN/Panel' );
var PhetFont = require( 'SCENERY_PHET/PhetFont' );
Expand Down Expand Up @@ -63,7 +62,8 @@ define( function( require ) {
majorTickLength: ( THUMB_SIZE.height / 2 ) + ( TRACK_SIZE.height / 2 ) + 2,
valueXMargin: 20,
valueYMargin: 4,
valueBackgroundStroke: 'black'
valueBackgroundStroke: 'black',
tandem: tandem.createTandem( 'numberControl' )
} );

Panel.call( this, numberControl, {
Expand All @@ -73,7 +73,8 @@ define( function( require ) {
maxWidth: 224,
minWidth: 224,
resize: false,
align: 'right'
align: 'right',
tandem: tandem
} );
}

Expand Down
14 changes: 3 additions & 11 deletions js/gravity-force-lab/view/MassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,9 @@ define( function( require ) {
}
} );

model.showValuesProperty.lazyLink( function() {
redrawForce();
} );

massModel.radiusProperty.lazyLink( function() {
redrawForce();
} );

model.forceProperty.lazyLink( function() {
redrawForce();
} );
model.showValuesProperty.lazyLink( redrawForce );
massModel.radiusProperty.lazyLink( redrawForce );
model.forceProperty.lazyLink( redrawForce );

massModel.baseColorProperty.link( function( baseColor ) {
updateGradient( baseColor );
Expand Down
16 changes: 13 additions & 3 deletions js/gravity-force-lab/view/ParameterControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,28 @@ define( function( require ) {
xMargin: 10,
yMargin: 10,
minWidth: 170,
align: 'left'
align: 'left',
tandem: tandem
}, options );

var node = new Node();
var showValueText = new Text( showValuesString, { font: new PhetFont( 16 ), maxWidth: MAX_CAPTION_WIDTH } );
var showValueCheckBox = new CheckBox( showValueText, model.showValuesProperty, { cursor: 'pointer' } );
var showValueCheckBox = new CheckBox(
showValueText,
model.showValuesProperty,
{ cursor: 'pointer', tandem: tandem.createTandem( 'showValueCheckBox' ) } );
node.addChild( showValueCheckBox );

var constantRadiusText = new Text( constantRadiusString, {
font: new PhetFont( 16 ),
maxWidth: MAX_CAPTION_WIDTH
} );
var constantRadiusCheckBox = new CheckBox( constantRadiusText, model.constantRadiusProperty, { cursor: 'pointer' } );

var constantRadiusCheckBox = new CheckBox(
constantRadiusText,
model.constantRadiusProperty,
{ cursor: 'pointer', tandem: tandem.createTandem( 'constantRadiusCheckBox' ) }
);
constantRadiusCheckBox.top = showValueCheckBox.bottom + 10;
node.addChild( constantRadiusCheckBox );
Panel.call( this, node, options );
Expand Down

0 comments on commit b2673f3

Please sign in to comment.