From 81dd0171b4c86a295e7c27c8556db4c4ffcca434 Mon Sep 17 00:00:00 2001 From: jessegreenberg Date: Tue, 11 Jul 2017 19:56:48 -0600 Subject: [PATCH] reuse OutOfBallsDialog because hide no longer disposes, see phetsims/joist#424 --- js/lab/view/LabScreenView.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/lab/view/LabScreenView.js b/js/lab/view/LabScreenView.js index e8059239..4a9f9663 100644 --- a/js/lab/view/LabScreenView.js +++ b/js/lab/view/LabScreenView.js @@ -143,6 +143,9 @@ define( function( require ) { } } ); + // OutOfBallsDialog, created lazily because Dialog requires sim bounds during construction + var dialog = null; + // no need to dispose of this link model.isBallCapReachedProperty.lazyLink( function( isBallCapReached ) { @@ -150,7 +153,10 @@ define( function( require ) { if ( isBallCapReached ) { // pop up a dialog - new OutOfBallsDialog().show(); + if ( !dialog ) { + dialog = new OutOfBallsDialog(); + } + dialog.show(); // sets the play button to active. playPanel.setPlayButtonVisible();