phetsims / fractions-intro

"Fractions Intro" is an educational simulation in HTML5, by PhET Interactive Simulations.
MIT License
1 stars 3 forks source link

Fix MAX Enable and Disable Property #74

Closed michaelm396 closed 5 years ago

michaelm396 commented 7 years ago

Currently the Fractions-proto simulation does not allow the Max Spinner to decrease if the number of filled cells is set to numerator/denominator = maxProperty. This is not true for the java implementation of fractions intro as the canDecreaseMaxProperty should always be enabled unless the MAXRANGE.min is reached (proto/ProtoScreenView)_.

var canDecreaseMaxProperty` = new DerivedProperty( modelProperties, function( numerator, denominator, max ) {
  return ( max - 1 ) >= ProtoConstants.MAX_RANGE.min && numerator / denominator <= ( max - 1 );
} );

In the Fractions-Intro simulation, we implemented a MaxProperty that would only disable if MAXRANGE.min is satisfied (intro/MaxSpinner)._


var maxDownEnabledProperty = new DerivedProperty( [ maxProperty ],
  function( maxNumberOfUnits ) { return maxNumberOfUnits > IntroConstants.MAX_RANGE.min; } );

We finally created a function of NumeratorProperty, which relied on the value of the maxProperty in order to determine its return value.

coledu commented 7 years ago

Fix the enable and disable. Still need to work on getting the correct numerator. And moving filled Cell from the pop to container to the next closest empty cell.

veillette commented 7 years ago

I reverted the change to annotation which was initially correct. Otherwise the work is done. Assigning to @jonathanolson for review.