Skip to content

Commit

Permalink
#255 set home screen background color in HomeScreen, not in HomeScree…
Browse files Browse the repository at this point in the history
…nView, and use it correctly in Sim to update LookAndFeel.backgroundColor
  • Loading branch information
pixelzoom committed Jun 30, 2015
1 parent c14a0e6 commit a483910
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 8 additions & 1 deletion js/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -35,7 +40,9 @@ define( function( require ) {
// View is where all of the work is done
function() {
return new HomeScreenView( sim, options );
}
},

options
);
}

Expand Down
2 changes: 0 additions & 2 deletions js/HomeScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } ),
Expand Down
3 changes: 2 additions & 1 deletion js/Sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit a483910

Please sign in to comment.