Skip to content

Commit

Permalink
bug fix for html slider range that didn't align with step value, #535
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 30, 2022
1 parent acf2979 commit 8641054
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions js/common/model/RAPRatio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const DEFAULT_TERM_VALUE_RANGE = rapConstants.TOTAL_RATIO_TERM_VALUE_RANGE;
// because that threshold value, by definition, will unlock the ratio, see https://github.com/phetsims/ratio-and-proportion/issues/257#issuecomment-748285667
const LOCK_RATIO_RANGE_MIN = rapConstants.NO_SUCCESS_VALUE_THRESHOLD + Number.EPSILON;

// This value needs to be an "even and round" number as it pertains to the step size of the sliders that control the ratio.
// See https://github.com/phetsims/ratio-and-proportion/issues/535
assert && assert( LOCK_RATIO_RANGE_MIN === 0.01, 'please be careful when changing this' );

class RAPRatio {

// Keep two references so that this can be public readonly, AND changed internally.
Expand Down
2 changes: 1 addition & 1 deletion js/common/rapConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RAPConstants extends PhetioObject {

// The value in which when either the antecedent or consequent is less than this, the ratio cannot be "in proportion".
// Add .001 to support two keyboard nav motions above 0 (counting the min range being >0).
public NO_SUCCESS_VALUE_THRESHOLD = 0.01;
public NO_SUCCESS_VALUE_THRESHOLD = 0.01 - Number.EPSILON;

public QUERY_PARAMETERS = RAPQueryParameters;

Expand Down

0 comments on commit 8641054

Please sign in to comment.