From 8ac863c4e1c06c736a55792f58966e272fd08c2c Mon Sep 17 00:00:00 2001 From: Chris Malley Date: Thu, 28 Mar 2019 12:22:44 -0600 Subject: [PATCH] add Checkbox to sun demo app, #488 --- js/demo/ComponentsScreenView.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/js/demo/ComponentsScreenView.js b/js/demo/ComponentsScreenView.js index 21bfb289..c47a405a 100644 --- a/js/demo/ComponentsScreenView.js +++ b/js/demo/ComponentsScreenView.js @@ -15,6 +15,7 @@ define( function( require ) { var AccordionBox = require( 'SUN/AccordionBox' ); var AlignBox = require( 'SCENERY/nodes/AlignBox' ); var AlignGroup = require( 'SCENERY/nodes/AlignGroup' ); + var BooleanProperty = require( 'AXON/BooleanProperty' ); var Carousel = require( 'SUN/Carousel' ); var Checkbox = require( 'SUN/Checkbox' ); var Circle = require( 'SCENERY/nodes/Circle' ); @@ -55,6 +56,7 @@ define( function( require ) { * {function(Bounds2): Node} createNode - creates the scene graph for the demo */ { label: 'Carousel', createNode: demoCarousel }, + { label: 'Checkbox', createNode: demoCheckbox }, { label: 'ComboBox', createNode: demoComboBox }, { label: 'HSlider', createNode: demoHSlider }, { label: 'VSlider', createNode: demoVSlider }, @@ -136,6 +138,28 @@ define( function( require ) { } ); }; + var demoCheckbox = function( layoutBounds ) { + + const property = new BooleanProperty( true ); + const enabledProperty = new BooleanProperty( true ); + + const checkbox = new Checkbox( new Text( 'My Awesome Checkbox', { + font: new PhetFont( 30 ) + } ), property, { + enabledProperty: enabledProperty + } ); + + const enabledCheckbox = new Checkbox( new Text( 'enabled', { + font: new PhetFont( 20 ) + } ), enabledProperty ); + + return new VBox( { + children: [ checkbox, enabledCheckbox ], + spacing: 30, + center: layoutBounds.center + } ); + }; + // Creates a demo of ComboBox var demoComboBox = function( layoutBounds ) {