Skip to content

Commit

Permalink
Inline some variables, see #123
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jun 4, 2024
1 parent 1017604 commit 7d59664
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
11 changes: 4 additions & 7 deletions js/buoyancy/view/BuoyancyExploreScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ import CuboidView from '../../common/view/CuboidView.js';
import ScaleView from '../../common/view/ScaleView.js';
import MassView from '../../common/view/MassView.js';

// constants
const MARGIN = DensityBuoyancyCommonConstants.MARGIN;

export default class BuoyancyExploreScreenView extends DensityBuoyancyScreenView<BuoyancyExploreModel> {

protected rightBox: PrimarySecondaryControlsNode;
Expand All @@ -56,14 +53,14 @@ export default class BuoyancyExploreScreenView extends DensityBuoyancyScreenView
this.model.poolBounds.left,
this.model.poolBounds.top,
this.model.poolBounds.front
) ).x - 2 * MARGIN
) ).x - 2 * DensityBuoyancyCommonConstants.MARGIN
} );

this.addChild( new AlignBox( buoyancyDisplayOptionsPanel, {
alignBoundsProperty: this.visibleBoundsProperty,
xAlign: 'left',
yAlign: 'bottom',
margin: MARGIN
margin: DensityBuoyancyCommonConstants.MARGIN
} ) );

const displayedMysteryMaterials = [
Expand Down Expand Up @@ -98,7 +95,7 @@ export default class BuoyancyExploreScreenView extends DensityBuoyancyScreenView
alignBoundsProperty: this.visibleBoundsProperty,
xAlign: 'center',
yAlign: 'bottom',
margin: MARGIN
margin: DensityBuoyancyCommonConstants.MARGIN
} ) );

[ model.primaryMass, model.secondaryMass ].forEach( mass => {
Expand Down Expand Up @@ -164,7 +161,7 @@ export default class BuoyancyExploreScreenView extends DensityBuoyancyScreenView
alignBoundsProperty: this.visibleBoundsProperty,
xAlign: 'right',
yAlign: 'top',
margin: MARGIN
margin: DensityBuoyancyCommonConstants.MARGIN
} ) );

const blocksRadioButtonGroup = new BlocksRadioButtonGroup( model.modeProperty, {
Expand Down
2 changes: 1 addition & 1 deletion js/buoyancy/view/BuoyancyIntroScreenView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class BuoyancyIntroScreenView extends DensityBuoyancyScreenView<B
public constructor( model: BuoyancyIntroModel, options: DensityBuoyancyScreenViewOptions ) {

super( model, combineOptions<DensityBuoyancyScreenViewOptions>( {

// Custom just for this screen
cameraLookAt: new Vector3( 0, -0.1, 0 ),

Expand Down Expand Up @@ -89,7 +90,6 @@ export default class BuoyancyIntroScreenView extends DensityBuoyancyScreenView<B
margin: MARGIN
} ) );


// Materials are set in densityBox.setMaterials() below
const densityAccordionBox = new DensityAccordionBox( {
contentWidthMax: this.rightSideMaxContentWidthProperty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ export default class BuoyancyApplicationsScreenView extends DensityBuoyancyScree
} );

// This DerivedProperty doesn't need disposal, since everything here lives for the lifetime of the simulation
const airLitersProperty = new DerivedProperty( [ model.bottle.interiorVolumeProperty ], volume => {
return toLiters( 0.01 - volume );
} );
const airLitersProperty = new DerivedProperty( [ model.bottle.interiorVolumeProperty ], volume => toLiters( 0.01 - volume ) );

let materialChangeLocked = false;
Multilink.lazyMultilink( [ model.customDensityProperty, model.bottle.interiorMassProperty, model.customDensityControlVisibleProperty ], density => {
Expand Down

0 comments on commit 7d59664

Please sign in to comment.