diff --git a/js/OptionsDialog.js b/js/OptionsDialog.js index d0cf8983..e0e0a77d 100644 --- a/js/OptionsDialog.js +++ b/js/OptionsDialog.js @@ -3,54 +3,26 @@ /** * Shows an Options dialog that consists of sim-global options. * - * Options are provided as 'globalOptions' inside a sim's options. - * * @author Jonathan Olson */ define( function( require ) { 'use strict'; // modules - var VBox = require( 'SCENERY/nodes/VBox' ); var Text = require( 'SCENERY/nodes/Text' ); var inherit = require( 'PHET_CORE/inherit' ); var PhetFont = require( 'SCENERY_PHET/PhetFont' ); - var CheckBox = require( 'SUN/CheckBox' ); var Dialog = require( 'JOIST/Dialog' ); // strings var optionsTitleString = require( 'string!JOIST/options.title' ); /** - * The options should be an array of item objects, which all have item.type. The following types are available: - * - * { // 'boolean' will show up as a labeled CheckBox - * type: 'boolean', - * label: 'Some Option', - * property: someBooleanProperty - * } - * - * @param {Array} options + * @param {Node} optionsNode * @constructor */ - function OptionsDialog( options ) { - - var children = []; - for ( var i = 0; i < options.length; i++ ) { - var option = options[i]; - - switch( option.type ) { - case 'boolean': - children.push( new CheckBox( new Text( option.label, { font: new PhetFont( 15 ) } ), option.property, {} ) ); - break; - default: - throw new Error( 'unknown option type: ' + option.type ); - } - } - - var content = new VBox( { align: 'left', spacing: 10, children: children } ); - - Dialog.call( this, content, { + function OptionsDialog( optionsNode ) { + Dialog.call( this, optionsNode, { title: new Text( optionsTitleString, { font: new PhetFont( 30 ) } ), titleAlign: 'center', modal: true, @@ -60,5 +32,8 @@ define( function( require ) { inherit( Dialog, OptionsDialog ); + OptionsDialog.DEFAULT_FONT = new PhetFont( 15 ); + OptionsDialog.DEFAULT_SPACING = 10; + return OptionsDialog; } ); \ No newline at end of file diff --git a/js/PhetMenu.js b/js/PhetMenu.js index ba763c7c..b98bbb7c 100644 --- a/js/PhetMenu.js +++ b/js/PhetMenu.js @@ -121,9 +121,9 @@ define( function( require ) { var itemDescriptors = [ { text: optionsString, - present: !!sim.options.globalOptions, + present: !!sim.options.optionsNode, callback: function() { - new OptionsDialog( sim.options.globalOptions ).show(); + new OptionsDialog( sim.options.optionsNode ).show(); } }, { diff --git a/js/Sim.js b/js/Sim.js index 3835157c..6cebfc38 100644 --- a/js/Sim.js +++ b/js/Sim.js @@ -57,7 +57,7 @@ define( function( require ) { standalone: false, // whether to run the screen indicated by screenIndex as a standalone sim credits: {}, // credits, see AboutDialog for format - globalOptions: null, // replace with globalOptions described in OptionsDialog + optionsNode: null, // a node placed into the Options dialog (if available) // if true, prints screen initialization time (total, model, view) to the console and displays // profiling information on the screen