Skip to content

Commit

Permalink
Add reentrant documentation, see: #78
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Jul 5, 2022
1 parent 6716149 commit de602c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/intro/model/WaterCupModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ export default class WaterCupModel extends PhetioObject {
this.x = options.x;
this.y = options.y;
this.resetEmitter = new Emitter();
//REVIEW document why reentrant:true is needed here, because we typically try to avoid that

// When a 3D cup's slider is changed enabledRangeProperty is updated accordingly.
// If the range shrinks, an out of range adapterProperty will be constrained updating the waterLevels of 2D and 3D cups,
// which may trigger another change in this enabledRangeProperty requiring reentrant: true
this.enabledRangeProperty = new Property<Range>( new Range( MeanShareAndBalanceConstants.CUP_RANGE_MIN, MeanShareAndBalanceConstants.CUP_RANGE_MAX ), { reentrant: true } );
this.waterLevelProperty = new NumberProperty( MeanShareAndBalanceConstants.WATER_LEVEL_DEFAULT, combineOptions<NumberPropertyOptions>( {
range: new Range( MeanShareAndBalanceConstants.CUP_RANGE_MIN, MeanShareAndBalanceConstants.CUP_RANGE_MAX ),
Expand Down

0 comments on commit de602c7

Please sign in to comment.