From a4839101993e03dedb27cbbaee1cc9437d303861 Mon Sep 17 00:00:00 2001 From: Chris Malley Date: Tue, 30 Jun 2015 17:32:12 -0600 Subject: [PATCH] #255 set home screen background color in HomeScreen, not in HomeScreenView, and use it correctly in Sim to update LookAndFeel.backgroundColor --- js/HomeScreen.js | 9 ++++++++- js/HomeScreenView.js | 2 -- js/Sim.js | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/HomeScreen.js b/js/HomeScreen.js index 7dce0a0f..77f1131f 100644 --- a/js/HomeScreen.js +++ b/js/HomeScreen.js @@ -18,6 +18,11 @@ define( function( require ) { * @constructor */ function HomeScreen( sim, options ) { + + options = _.extend( { + backgroundColor: 'black' //TODO joist#255 this should come from LookAndFeel + } ); + //name, homeScreenIcon, createModel, createView, options Screen.call( this, @@ -35,7 +40,9 @@ define( function( require ) { // View is where all of the work is done function() { return new HomeScreenView( sim, options ); - } + }, + + options ); } diff --git a/js/HomeScreenView.js b/js/HomeScreenView.js index c2e8fd57..5e37c2dc 100644 --- a/js/HomeScreenView.js +++ b/js/HomeScreenView.js @@ -42,8 +42,6 @@ define( function( require ) { //Renderer must be specified here because the node is added directly to the scene (instead of to some other node that already has svg renderer ScreenView.call( this, { layoutBounds: LAYOUT_BOUNDS } ); - this.backgroundColor = 'black'; //TODO joist#255 this should be in LookAndFeel - //iPad doesn't support Century Gothic, so fall back to Futura, see http://wordpress.org/support/topic/font-not-working-on-ipad-browser var title = new Text( sim.name, { font: new PhetFont( { size: 52, family: TITLE_FONT_FAMILY } ), diff --git a/js/Sim.js b/js/Sim.js index 287c208e..becbbd31 100644 --- a/js/Sim.js +++ b/js/Sim.js @@ -154,6 +154,7 @@ define( function( require ) { // global bounds for the screen-specific part (excludes the navigation bar) screenBounds: null, + //TODO this comment is wrong, HomeScreen is a subtype of Screen. // [read-only] {Screen|null} - The current screen, or null if showing the home screen (which is NOT a Screen) currentScreen: null, @@ -376,7 +377,7 @@ define( function( require ) { this.updateBackground = function() { sim.lookAndFeel.backgroundColor = sim.currentScreen ? sim.currentScreen.backgroundColor.toCSS() : - 'black'; //TODO why isn't this sim.homeScreen.backgroundColor.toCSS() ? + sim.homeScreen.backgroundColor.toCSS() }; sim.lookAndFeel.backgroundColorProperty.link( function( backgroundColor ) {