Skip to content

Commit

Permalink
make "Out of balls!" dialog look better, pass stringTest, #72
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 30, 2016
1 parent ad825d2 commit 0ceac3b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
27 changes: 23 additions & 4 deletions js/lab/view/LabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ define( function( require ) {
var HopperModeControl = require( 'PLINKO_PROBABILITY/lab/view/HopperModeControl' );
var inherit = require( 'PHET_CORE/inherit' );
var LabPlayPanel = require( 'PLINKO_PROBABILITY/lab/view/LabPlayPanel' );
var MultiLineText = require( 'SCENERY_PHET/MultiLineText' );
var Node = require( 'SCENERY/nodes/Node' );
var Panel = require( 'SUN/Panel' );
var PegControls = require( 'PLINKO_PROBABILITY/lab/view/PegControls' );
var PegsNode = require( 'PLINKO_PROBABILITY/common/view/PegsNode' );
var PhetFont = require( 'SCENERY_PHET/PhetFont' );
Expand All @@ -27,6 +27,7 @@ define( function( require ) {
var PlinkoProbabilityConstants = require( 'PLINKO_PROBABILITY/common/PlinkoProbabilityConstants' );
var PlinkoProbabilityQueryParameters = require( 'PLINKO_PROBABILITY/common/PlinkoProbabilityQueryParameters' );
var StatisticsAccordionBox = require( 'PLINKO_PROBABILITY/lab/view/StatisticsAccordionBox' );
var Text = require( 'SCENERY/nodes/Text' );
var TrajectoryPath = require( 'PLINKO_PROBABILITY/lab/view/TrajectoryPath' );

// images
Expand Down Expand Up @@ -152,15 +153,33 @@ define( function( require ) {
//TODO test this
// no need to dispose of this link
model.isBallCapReachedProperty.lazyLink( function( isBallCapReached ) {

// pops up a dialog box when the number of balls is reached.
if ( isBallCapReached ) {
new Dialog( new MultiLineText( outOfBallsString, { font: new PhetFont( 50 ) } ), {

var messageNode = new Text( outOfBallsString, {
font: new PhetFont( 25 ),
maxWidth: 350
} );

// WORKAROUND: Intermediate panel needed to workaround problem that occurs when using
// xMargin and yMargin options for Dialog, see https://github.com/phetsims/joist/issues/346
var dialogContent = new Panel( messageNode, {
fill: null,
stroke: null,
xMargin: 40,
yMargin: 30
} );

new Dialog( dialogContent, {
modal: true,
// focusable so it can be dismissed
focusable: true
focusable: true // so it can be dismissed
} ).show();

//TODO this isn't working
// sets the play button to active.
playPanel.setPlayButtonVisible();

// it is not playing anymore
model.isPlayingProperty.set( false );
}
Expand Down
2 changes: 1 addition & 1 deletion plinko-probability-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"value": "Ideal"
},
"outOfBalls": {
"value": "Out\nof\nBalls!"
"value": "Out of balls!"
},
"muGreek": {
"value": "\u03BC"
Expand Down

0 comments on commit 0ceac3b

Please sign in to comment.