Skip to content

Commit

Permalink
add reset button (see #20)
Browse files Browse the repository at this point in the history
  • Loading branch information
veillette committed Jul 27, 2017
1 parent 9a6dcb5 commit 4eae82e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/optics-lab/model/OpticsLabModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ define( function( require ) {
* @public
*/
reset: function() {
this.sources.clear();
this.components.clear();
this.pieces.clear();
this.processRaysCountProperty.reset();
},

Expand Down
12 changes: 12 additions & 0 deletions js/optics-lab/view/OpticsLabScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ define( function( require ) {
var ToolDrawerPanel = require( 'OPTICS_LAB/optics-lab/view/ToolDrawerPanel' );
var opticsLab = require( 'OPTICS_LAB/opticsLab' );
var Type = require( 'OPTICS_LAB/optics-lab/model/Type' );
var ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' );

/**
* @extends {ScreenView}
Expand Down Expand Up @@ -50,6 +51,17 @@ define( function( require ) {
this.toolDrawerPanel.bottom = this.layoutBounds.bottom - 10;
this.toolDrawerPanel.centerX = this.layoutBounds.centerX;

var resetAllButton = new ResetAllButton( {
listener: function() {
opticsLabModel.reset();
},
right: this.layoutBounds.right - 20,
top: this.toolDrawerPanel.top
}
);

this.addChild( resetAllButton );

}//end constructor

opticsLab.register( 'OpticsLabScreenView', OpticsLabScreenView );
Expand Down

0 comments on commit 4eae82e

Please sign in to comment.