Skip to content

Commit

Permalink
rename type CreateSceneNodeFunction, #78
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed May 3, 2023
1 parent 78ecdfc commit 3cce9f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions js/common/view/RPALScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BeforeAfterNodeOptions } from './RPALSceneNode.js';
import DerivedProperty from '../../../../axon/js/DerivedProperty.js';
import BooleanIO from '../../../../tandem/js/types/BooleanIO.js';

export type CreateBeforeAfterNodeFunction = (
export type CreateSceneNodeFunction = (
reaction: Reaction,
beforeExpandedProperty: Property<boolean>,
afterExpandedProperty: Property<boolean>,
Expand All @@ -33,12 +33,12 @@ export default class RPALScreenView<R extends Reaction = Reaction> extends Scree
/**
* @param model
* @param createEquationNode - creates an equation for a specified reaction
* @param createBeforeAfterNode - creates the Before/After boxes for a specified reaction
* @param createSceneNode - creates the Before/After boxes for a specified reaction
* @param tandem
*/
protected constructor( model: RPALBaseModel<R>,
createEquationNode: CreateEquationNodeFunction<R>,
createBeforeAfterNode: CreateBeforeAfterNodeFunction,
createSceneNode: CreateSceneNodeFunction,
tandem: Tandem ) {

super( {
Expand All @@ -62,7 +62,7 @@ export default class RPALScreenView<R extends Reaction = Reaction> extends Scree
const sceneNodesTandem = tandem.createTandem( 'sceneNodes' );
const beforeAfterNodes = model.reactions.map( reaction => {
const beforeAfterNodesTandem = sceneNodesTandem.createTandem( `${reaction.tandem.name}SceneNode` );
return createBeforeAfterNode( reaction, beforeExpandedProperty, afterExpandedProperty, {
return createSceneNode( reaction, beforeExpandedProperty, afterExpandedProperty, {
visibleProperty: new DerivedProperty( [ model.reactionProperty ], value => ( value === reaction ), {
tandem: beforeAfterNodesTandem.createTandem( 'visibleProperty' ),
phetioValueType: BooleanIO
Expand Down
8 changes: 4 additions & 4 deletions js/molecules/view/MoleculesScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Tandem from '../../../../tandem/js/Tandem.js';
import RPALConstants from '../../common/RPALConstants.js';
import RPALSceneNode, { BeforeAfterNodeOptions } from '../../common/view/RPALSceneNode.js';
import MoleculesEquationNode from '../../common/view/MoleculesEquationNode.js';
import RPALScreenView, { CreateBeforeAfterNodeFunction } from '../../common/view/RPALScreenView.js';
import RPALScreenView, { CreateSceneNodeFunction } from '../../common/view/RPALScreenView.js';
import reactantsProductsAndLeftovers from '../../reactantsProductsAndLeftovers.js';
import MoleculesModel from '../model/MoleculesModel.js';
import { CreateEquationNodeFunction } from '../../common/view/ReactionBarNode.js';
Expand All @@ -27,16 +27,16 @@ export default class MoleculesScreenView extends RPALScreenView {
visibleProperty: visibleProperty
} );

// Creates the Before/After interface for a specified reaction.
const createBeforeAfterNode: CreateBeforeAfterNodeFunction =
// Creates the user interface for a specified reaction.
const createSceneNode: CreateSceneNodeFunction =
( reaction, beforeExpandedProperty, afterExpandedProperty, options ) =>
new RPALSceneNode( reaction, beforeExpandedProperty, afterExpandedProperty,
combineOptions<BeforeAfterNodeOptions>( {
contentSize: RPALConstants.MOLECULES_BEFORE_AFTER_BOX_SIZE,
minIconSize: new Dimension2( 30, 25 ) // eyeballed
}, options ) );

super( model, createEquationNode, createBeforeAfterNode, tandem );
super( model, createEquationNode, createSceneNode, tandem );
}
}

Expand Down
8 changes: 4 additions & 4 deletions js/sandwiches/view/SandwichesScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Dimension2 from '../../../../dot/js/Dimension2.js';
import Tandem from '../../../../tandem/js/Tandem.js';
import RPALConstants from '../../common/RPALConstants.js';
import RPALSceneNode, { BeforeAfterNodeOptions } from '../../common/view/RPALSceneNode.js';
import RPALScreenView, { CreateBeforeAfterNodeFunction } from '../../common/view/RPALScreenView.js';
import RPALScreenView, { CreateSceneNodeFunction } from '../../common/view/RPALScreenView.js';
import reactantsProductsAndLeftovers from '../../reactantsProductsAndLeftovers.js';
import ReactantsProductsAndLeftoversStrings from '../../ReactantsProductsAndLeftoversStrings.js';
import SandwichesModel from '../model/SandwichesModel.js';
Expand All @@ -33,8 +33,8 @@ export default class SandwichesScreenView extends RPALScreenView<SandwichRecipe>
const createEquationNode: CreateEquationNodeFunction<SandwichRecipe> =
( reaction, visibleProperty ) => new SandwichesEquationNode( reaction, maxSandwichSize, visibleProperty );

// Creates the Before/After interface for a specified reaction.
const createBeforeAfterNode: CreateBeforeAfterNodeFunction =
// Creates the user interface for a specified reaction.
const createSceneNode: CreateSceneNodeFunction =
( reaction, beforeExpandedProperty, afterExpandedProperty, options ) =>
new RPALSceneNode( reaction, beforeExpandedProperty, afterExpandedProperty,
combineOptions<BeforeAfterNodeOptions>( {
Expand All @@ -46,7 +46,7 @@ export default class SandwichesScreenView extends RPALScreenView<SandwichRecipe>
boxYMargin: 8 // large enough to accommodate the biggest sandwich
}, options ) );

super( model, createEquationNode, createBeforeAfterNode, tandem );
super( model, createEquationNode, createSceneNode, tandem );
}
}

Expand Down

0 comments on commit 3cce9f9

Please sign in to comment.