Skip to content

Commit

Permalink
Rename missed variables, see #627
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Apr 16, 2020
1 parent 7385997 commit e06929f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions js/HomeScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function HomeScreenView( simName, model, tandem, options ) {
} )
} );

const title = new Text( simName, {
const titleText = new Text( simName, {
font: new PhetFont( {
size: 52,
family: TITLE_FONT_FAMILY
Expand All @@ -72,12 +72,12 @@ function HomeScreenView( simName, model, tandem, options ) {
} );

// Have this before adding the child to support the startup layout.
title.boundsProperty.link( () => {
title.centerX = this.layoutBounds.centerX;
titleText.boundsProperty.link( () => {
titleText.centerX = this.layoutBounds.centerX;
} );

this.addChild( title );
title.scale( Math.min( 1, 0.9 * this.layoutBounds.width / title.width ) );
this.addChild( titleText );
titleText.scale( Math.min( 1, 0.9 * this.layoutBounds.width / titleText.width ) );

const buttonGroupTandem = tandem.createTandem( 'buttonGroup' );

Expand Down
20 changes: 10 additions & 10 deletions js/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function NavigationBar( sim, isMultiScreenSimDisplayingSingleScreen, tandem ) {
}

// Sim title
this.titleTextNode = new Text( title, {
this.titleText = new Text( title, {
font: new PhetFont( 16 ),
fill: sim.lookAndFeel.navigationBarTextFillProperty,
tandem: tandem.createTandem( 'titleText' ),
Expand All @@ -136,8 +136,8 @@ function NavigationBar( sim, isMultiScreenSimDisplayingSingleScreen, tandem ) {
textProperty: { phetioFeatured: true }
}
} );
this.titleTextNode.setVisible( false );
this.barContents.addChild( this.titleTextNode );
this.titleText.setVisible( false );
this.barContents.addChild( this.titleText );

// @private - PhET button, fill determined by state of navigationBarFillProperty
this.phetButton = new PhetButton(
Expand Down Expand Up @@ -166,15 +166,15 @@ function NavigationBar( sim, isMultiScreenSimDisplayingSingleScreen, tandem ) {
/* single-screen sim */

// title can occupy all space to the left of the PhET button
this.titleTextNode.maxWidth = HomeScreenView.LAYOUT_BOUNDS.width - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN -
this.titleText.maxWidth = HomeScreenView.LAYOUT_BOUNDS.width - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN -
PHET_BUTTON_LEFT_MARGIN - this.a11yButtonsHBox.width - PHET_BUTTON_LEFT_MARGIN -
this.phetButton.width - PHET_BUTTON_RIGHT_MARGIN;
}
else {
/* multi-screen sim */

// Start with the assumption that the title can occupy (at most) this percentage of the bar.
const maxTitleWidth = Math.min( this.titleTextNode.width, 0.20 * HomeScreenView.LAYOUT_BOUNDS.width );
const maxTitleWidth = Math.min( this.titleText.width, 0.20 * HomeScreenView.LAYOUT_BOUNDS.width );

// pdom - container for the homeButton and all the screen buttons.
var buttons = new Node( {
Expand Down Expand Up @@ -261,13 +261,13 @@ function NavigationBar( sim, isMultiScreenSimDisplayingSingleScreen, tandem ) {
buttonsOrderedList.addChild( this.screenButtonsContainer );

// Now determine the actual width constraint for the sim title.
this.titleTextNode.maxWidth = this.screenButtonsContainer.left - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN -
this.titleText.maxWidth = this.screenButtonsContainer.left - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN -
HOME_BUTTON_RIGHT_MARGIN - this.homeButton.width - HOME_BUTTON_LEFT_MARGIN;
}

// initial layout (that doesn't need to change when we are re-laid out)
this.titleTextNode.left = TITLE_LEFT_MARGIN;
this.titleTextNode.centerY = NAVIGATION_BAR_SIZE.height / 2;
this.titleText.left = TITLE_LEFT_MARGIN;
this.titleText.centerY = NAVIGATION_BAR_SIZE.height / 2;
this.phetButton.bottom = NAVIGATION_BAR_SIZE.height - PHET_BUTTON_BOTTOM_MARGIN;

// only if some a11y buttons exist
Expand All @@ -293,7 +293,7 @@ function NavigationBar( sim, isMultiScreenSimDisplayingSingleScreen, tandem ) {
// only show the home button and screen buttons on the nav bar when a screen is showing, not the home screen
sim.screenProperty.link( screen => {
const showHomeScreen = screen === sim.homeScreen;
this.titleTextNode.setVisible( !showHomeScreen );
this.titleText.setVisible( !showHomeScreen );
if ( buttons ) {
buttons.setVisible( !showHomeScreen );
}
Expand Down Expand Up @@ -349,7 +349,7 @@ export default inherit( Node, NavigationBar, {
this.homeButton.right = this.screenButtonsContainer.left - HOME_BUTTON_RIGHT_MARGIN;

// max width relative to position of home button
this.titleTextNode.maxWidth = this.homeButton.left - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN;
this.titleText.maxWidth = this.homeButton.left - TITLE_LEFT_MARGIN - TITLE_RIGHT_MARGIN;
}
}
}, {
Expand Down

0 comments on commit e06929f

Please sign in to comment.