Skip to content

Commit

Permalink
delete redundant parameters from IntroPlayPanel, #112, #109
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Malley <[email protected]>
  • Loading branch information
pixelzoom committed May 23, 2018
1 parent 6f67a73 commit e6ab523
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions js/intro/view/IntroPlayPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ define( function( require ) {
var BALL_RADIUS = PlinkoProbabilityConstants.BALL_RADIUS;

/**
* @param {Function} updateBallsToCreateNumber - function that update the number of balls to be created
* @param {Property.<string>} ballModeProperty - see PlinkoProbabilityCommonModel
* @param {Property.<boolean>} isBallCapReachedProperty - describes maximum amount of balls
* @param {IntroModel} model
* @param {Object} [options]
* @constructor
*/
function IntroPlayPanel( updateBallsToCreateNumber, ballModeProperty, isBallCapReachedProperty, options ) {
function IntroPlayPanel( model, options ) {

options = _.extend( {
align: 'center',
Expand Down Expand Up @@ -62,9 +60,9 @@ define( function( require ) {

// Creation of radio button group for ball setting
var ballModeRadioButtons = new VerticalAquaRadioButtonGroup( [
{ node: oneBall, property: ballModeProperty, value: 'oneBall' },
{ node: tenBalls, property: ballModeProperty, value: 'tenBalls' },
{ node: maxBalls, property: ballModeProperty, value: 'maxBalls' }
{ node: oneBall, property: model.ballModeProperty, value: 'oneBall' },
{ node: tenBalls, property: model.ballModeProperty, value: 'tenBalls' },
{ node: maxBalls, property: model.ballModeProperty, value: 'maxBalls' }
], {
radius: 8, // radius of radio button circle
spacing: 10, // vertical spacing between each radio button
Expand All @@ -73,12 +71,12 @@ define( function( require ) {

//Creation of play button
var playButton = new PlayButton( {
listener: updateBallsToCreateNumber,
listener: model.updateBallsToCreateNumber.bind( model ),
enabled: true
} );

// Disables play button if maximum amount of balls are dropped
isBallCapReachedProperty.lazyLink( function( isBallCapReached ) {
model.isBallCapReachedProperty.lazyLink( function( isBallCapReached ) {
playButton.enabled = !isBallCapReached;
} );

Expand Down
2 changes: 1 addition & 1 deletion js/intro/view/IntroScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ define( function( require ) {
} );

// Play panel, at upper right
var playPanel = new IntroPlayPanel( model.updateBallsToCreateNumber.bind( model ), model.ballModeProperty, model.isBallCapReachedProperty, {
var playPanel = new IntroPlayPanel( model, {
minWidth: MIN_PANEL_WIDTH,
right: this.layoutBounds.maxX - PlinkoProbabilityConstants.PANEL_RIGHT_PADDING,
top: 10
Expand Down

0 comments on commit e6ab523

Please sign in to comment.