source: issm/oecreview/Archive/19101-20495/ISSM-19807-19808.diff@ 20498

Last change on this file since 20498 was 20498, checked in by Mathieu Morlighem, 9 years ago

CHG: done with Archive/19101-20495

File size: 690 bytes
RevLine 
[20498]1Index: ../trunk-jpl/src/m/plot/webgl.js
2===================================================================
3--- ../trunk-jpl/src/m/plot/webgl.js (revision 19807)
4+++ ../trunk-jpl/src/m/plot/webgl.js (revision 19808)
5@@ -116,11 +116,15 @@
6 return modelMatrix;
7 } //}}}
8 function rgb(value, min, max) { //{{{
9+
10+ var normalizedValue;
11
12 colorbar=colorbars["rainbow"];
13
14 value = clamp(value, min, max);
15- var normalizedValue = (value - min) / (max - min);
16+ if((max-min)!=0) normalizedValue = (value - min) / (max - min);
17+ else normalizedValue = value;
18+
19 var index = clamp(Math.round(normalizedValue * colorbar.length), 0, colorbar.length - 1);
20 return colorbar[index];
21 } //}}}
Note: See TracBrowser for help on using the repository browser.