Skip to content

Commit

Permalink
addressed more REVIEW comments, see #62
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet authored and Saurabh Totey committed May 12, 2021
1 parent 35cf761 commit 8c3e39f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions js/explore/model/TemperatureToColorMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ define( require => {
mapTemperatureToColor( temperature ) {

// calculate a normalized temperature value
// REVIEW: getNormalizedValue was just added to Range, perhaps use that instead
const normalizedTemperature = ( temperature - this.temperatureRange.min ) / this.temperatureRange.getLength();
const normalizedTemperature = this.temperatureRange.getNormalizedValue( temperature );

// Clamp the value. While it would be possible to create and use a linear function for out-of-bounds values, but
// so far this has not been necessary, so it doesn't seem worth it. Add it if you need it.
Expand All @@ -75,9 +74,8 @@ define( require => {
let green = 0;
let blue = 0;

// REVIEW: numberOfColors, according to CRC
const numColors = RdYlBu_data.length;
const scaledValue = value * ( numColors - 1 );
const numberOfColors = RdYlBu_data.length;
const scaledValue = value * ( numberOfColors - 1 );
const lowerEntryIndex = Math.floor( scaledValue );
const upperEntryIndex = Math.ceil( scaledValue );
if ( lowerEntryIndex === upperEntryIndex ) {
Expand Down

0 comments on commit 8c3e39f

Please sign in to comment.