Skip to content

Commit

Permalink
Preload energy chunks in blocks and beakers, see #306
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Jan 15, 2020
1 parent 9f779ba commit 7b8db6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/intro/model/EFACIntroModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ define( require => {
tandem: tandem.createTandem( 'beakerGroup' ),
phetioType: PhetioGroupIO( BeakerIO ),
supportsDynamicState: false,
phetioDocumentation: 'group that contains 0-' + EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS+ ' beakers'
phetioDocumentation: 'group that contains 0-' + EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS + ' beakers'
} );

// create any specified beakers
Expand Down Expand Up @@ -280,6 +280,13 @@ define( require => {

// @public - used to notify the view that a manual step was called
this.manualStepEmitter = new Emitter( { parameters: [ { valueType: 'number' } ] } );

// preload energy chunks in blocks and beakers after state has been set
_.hasIn( window, 'phet.phetIo.phetioEngine' ) && phet.phetIo.phetioEngine.phetioStateEngine.stateSetEmitter.addListener( () => {
this.thermalContainers.forEach( thermalContainer => {
thermalContainer.addInitialEnergyChunks();
} );
} );
}

/**
Expand Down
3 changes: 3 additions & 0 deletions js/systems/model/BeakerHeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ define( require => {
preloadComplete = true;
}
}

// match beaker's energy chunks to its energy level
this.beaker.addInitialEnergyChunks();
}

//REVEIW #247 what are constiables?
Expand Down

0 comments on commit 7b8db6b

Please sign in to comment.