Skip to content

Commit

Permalink
Factor out allRanges, see #293
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jan 1, 2019
1 parent 36f41ea commit 3fd5ade
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/interference/view/SeparationControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ define( require => {
const waterSceneRange = waterSeparationProperty.range;
const soundSceneRange = soundSeparationProperty.range;
const lightSceneRange = lightSeparationProperty.range;
const allRanges = [ waterSceneRange, soundSceneRange, lightSceneRange ];

// Switch between controls for each scene. No advantage in using SceneToggleNode in this case
// because the control constructor calls are substantially different.
Expand All @@ -47,23 +48,23 @@ define( require => {
valuePattern: cmValueString,
decimalPlaces: 1,
constrainValue: value => Util.roundToInterval( value, 0.5 ),
majorTicks: createTicks( waterSceneRange, [ waterSceneRange, soundSceneRange, lightSceneRange ] )
majorTicks: createTicks( waterSceneRange, allRanges )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) )
}, {
value: model.soundScene,
node: new NumberControl( separationString, soundSeparationProperty, soundSceneRange, _.extend( {
delta: 1,
valuePattern: cmValueString,
constrainValue: value => Util.roundToInterval( value, 10 ),
majorTicks: createTicks( soundSceneRange, [ waterSceneRange, soundSceneRange, lightSceneRange ] )
majorTicks: createTicks( soundSceneRange, allRanges )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) )
}, {
value: model.lightScene,
node: new NumberControl( separationString, lightSeparationProperty, lightSceneRange, _.extend( {
delta: 10,
valuePattern: nmValueString,
constrainValue: value => Util.roundToInterval( value, 100 ),
majorTicks: createTicks( lightSceneRange, [ waterSceneRange, soundSceneRange, lightSceneRange ] )
majorTicks: createTicks( lightSceneRange, allRanges )
}, WaveInterferenceConstants.NUMBER_CONTROL_OPTIONS ) )
} ] );
}
Expand Down

0 comments on commit 3fd5ade

Please sign in to comment.