Skip to content

Commit

Permalink
Set Property to default to reentrant: false and specify overrides for…
Browse files Browse the repository at this point in the history
… reentrant Property instances, see phetsims/axon#179
  • Loading branch information
samreid committed Aug 21, 2018
1 parent 894ba5e commit d9d3e8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions js/mysolution/model/MySolutionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ define( function( require ) {
*/

// @public convenience Property that will synchronize with the concentration the currently selected solution
this.concentrationProperty = new Property( this.solutions[ DEFAULT_SOLUTION_TYPE ].concentrationProperty.get() );
this.concentrationProperty = new Property( this.solutions[ DEFAULT_SOLUTION_TYPE ].concentrationProperty.get(), {
reentrant: true
} );

// @public convenience Property that will synchronize with the strength of the currently selected solution
this.strengthProperty = new Property( this.solutions[ DEFAULT_SOLUTION_TYPE ].strengthProperty.get() );
this.strengthProperty = new Property( this.solutions[ DEFAULT_SOLUTION_TYPE ].strengthProperty.get(), {
reentrant: true
} );

var setStrength = function( value ) { self.strengthProperty.set( value ); };
var setConcentration = function( value ) { self.concentrationProperty.set( value ); };
Expand Down
4 changes: 3 additions & 1 deletion js/mysolution/view/ConcentrationSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ define( function( require ) {
this.sliderValueRange = new RangeWithValue( Util.log10( concentrationRange.min ), Util.log10( concentrationRange.max ), Util.log10( concentrationRange.defaultValue ) );

// @public property for slider value
this.sliderValueProperty = new Property( Util.log10( concentrationProperty.get() ) );
this.sliderValueProperty = new Property( Util.log10( concentrationProperty.get() ), {
reentrant: true
} );

this.sliderValueProperty.link( function( sliderValue ) {
self.concentrationProperty.set( Util.toFixedNumber( Math.pow( 10, sliderValue ), 10 ) ); // see issue#73
Expand Down
4 changes: 3 additions & 1 deletion js/mysolution/view/StrengthSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ define( function( require ) {
this.sliderValueRange = new RangeWithValue( Util.log10( strengthRange.min ), Util.log10( strengthRange.max ), Util.log10( strengthRange.defaultValue ) );

// @public slider's value
this.sliderValueProperty = new Property( Util.log10( strengthProperty.get() ) );
this.sliderValueProperty = new Property( Util.log10( strengthProperty.get() ), {
reentrant: true
} );

// map between linear and logarithmic
this.sliderValueProperty.link( function( sliderValue ) {
Expand Down

0 comments on commit d9d3e8f

Please sign in to comment.