From e6ab5235abf6643d53405a1b020086e98659bdd8 Mon Sep 17 00:00:00 2001 From: Chris Malley Date: Wed, 23 May 2018 13:29:51 -0600 Subject: [PATCH] delete redundant parameters from IntroPlayPanel, #112, #109 Signed-off-by: Chris Malley --- js/intro/view/IntroPlayPanel.js | 16 +++++++--------- js/intro/view/IntroScreenView.js | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/js/intro/view/IntroPlayPanel.js b/js/intro/view/IntroPlayPanel.js index 6f3f3e7f..b32f83e9 100644 --- a/js/intro/view/IntroPlayPanel.js +++ b/js/intro/view/IntroPlayPanel.js @@ -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.} ballModeProperty - see PlinkoProbabilityCommonModel - * @param {Property.} 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', @@ -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 @@ -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; } ); diff --git a/js/intro/view/IntroScreenView.js b/js/intro/view/IntroScreenView.js index daa92a9c..c4e78ef6 100644 --- a/js/intro/view/IntroScreenView.js +++ b/js/intro/view/IntroScreenView.js @@ -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