Skip to content

Commit

Permalink
Round value to nearest tenth during shift step, see: #195
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Apr 2, 2024
1 parent 2e167ac commit d3e0fe3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/balance-point/view/FulcrumSlider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ export default class FulcrumSlider extends HSlider {
trackFillDisabled: null,
trackStroke: null,
trackPickable: false,
keyboardStep: 0.5,
shiftKeyboardStep: MeanShareAndBalanceConstants.MEAN_ROUNDING_INTERVAL,
visibleProperty: DerivedProperty.not( isMeanFulcrumFixedProperty ),
constrainValue: value => Utils.roundToInterval( value, MeanShareAndBalanceConstants.MEAN_ROUNDING_INTERVAL ),

// Necessary to remove rounding errors and apply the constrainValue option during shift steps. https://github.com/phetsims/sun/issues/837
a11yMapValue: value => Utils.roundToInterval( value, MeanShareAndBalanceConstants.MEAN_ROUNDING_INTERVAL ),
trackSize: new Dimension2( MeanShareAndBalanceConstants.CHART_VIEW_WIDTH, 0 ),
drag: () => { this.wasDraggedProperty.value = true; }
}, providedOptions );
Expand Down

0 comments on commit d3e0fe3

Please sign in to comment.