|
@@ -114,7 +114,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
alpha = ( alpha - this.minV ) / ( this.maxV - this.minV );
|
|
|
|
|
|
- var colorPosition = Math.round ( alpha * this.n );
|
|
|
+ var colorPosition = Math.round( alpha * this.n );
|
|
|
colorPosition == this.n ? colorPosition -= 1 : colorPosition;
|
|
|
|
|
|
return this.lut[ colorPosition ];
|
|
@@ -139,7 +139,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
this.legend.layout = parameters.hasOwnProperty( 'layout' ) ? parameters[ 'layout' ] : 'vertical';
|
|
|
|
|
|
- this.legend.position = parameters.hasOwnProperty( 'position' ) ? parameters[ 'position' ] : { 'x': 21.5, 'y': 8, 'z': 5 };
|
|
|
+ this.legend.position = parameters.hasOwnProperty( 'position' ) ? parameters[ 'position' ] : { 'x': 4, 'y': 0, 'z': 0 };
|
|
|
|
|
|
this.legend.dimensions = parameters.hasOwnProperty( 'dimensions' ) ? parameters[ 'dimensions' ] : { 'width': 0.5, 'height': 3 };
|
|
|
|
|
@@ -152,7 +152,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
this.legend.ctx = this.legend.canvas.getContext( '2d' );
|
|
|
|
|
|
- this.legend.canvas.setAttribute( 'width', 1 );
|
|
|
+ this.legend.canvas.setAttribute( 'width', 1 );
|
|
|
this.legend.canvas.setAttribute( 'height', this.n );
|
|
|
|
|
|
this.legend.texture = new THREE.Texture( this.legend.canvas );
|
|
@@ -171,7 +171,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
for ( var j = this.map.length - 1; j >= 0; j -- ) {
|
|
|
|
|
|
- if ( i < this.map[ j ][ 0 ] && i >= this.map[ j - 1 ][ 0 ] ) {
|
|
|
+ if ( i < this.map[ j ][ 0 ] && i >= this.map[ j - 1 ][ 0 ] ) {
|
|
|
|
|
|
var min = this.map[ j - 1 ][ 0 ];
|
|
|
var max = this.map[ j ][ 0 ];
|
|
@@ -198,7 +198,7 @@ THREE.Lut.prototype = {
|
|
|
this.legend.texture.needsUpdate = true;
|
|
|
|
|
|
this.legend.legendGeometry = new THREE.PlaneBufferGeometry( this.legend.dimensions.width, this.legend.dimensions.height );
|
|
|
- this.legend.legendMaterial = new THREE.MeshBasicMaterial( { map : this.legend.texture, side : THREE.DoubleSide } );
|
|
|
+ this.legend.legendMaterial = new THREE.MeshBasicMaterial( { map: this.legend.texture, side: THREE.DoubleSide } );
|
|
|
|
|
|
this.legend.mesh = new THREE.Mesh( this.legend.legendGeometry, this.legend.legendMaterial );
|
|
|
|
|
@@ -305,7 +305,7 @@ THREE.Lut.prototype = {
|
|
|
this.legend.labels.notation = parameters.hasOwnProperty( 'notation' ) ? parameters[ 'notation' ] : 'standard';
|
|
|
|
|
|
var backgroundColor = { r: 255, g: 100, b: 100, a: 0.8 };
|
|
|
- var borderColor = { r: 255, g: 0, b: 0, a: 1.0 };
|
|
|
+ var borderColor = { r: 255, g: 0, b: 0, a: 1.0 };
|
|
|
var borderThickness = 4;
|
|
|
|
|
|
var canvasTitle = document.createElement( 'canvas' );
|
|
@@ -313,10 +313,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
contextTitle.font = 'Normal ' + this.legend.labels.fontsize * 1.2 + 'px ' + this.legend.labels.fontface;
|
|
|
|
|
|
- var metrics = contextTitle.measureText( this.legend.labels.title.toString() + this.legend.labels.um.toString() );
|
|
|
- var textWidth = metrics.width;
|
|
|
-
|
|
|
- contextTitle.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + backgroundColor.a + ')';
|
|
|
+ contextTitle.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + backgroundColor.a + ')';
|
|
|
|
|
|
contextTitle.strokeStyle = 'rgba(' + borderColor.r + ',' + borderColor.g + ',' + borderColor.b + ',' + borderColor.a + ')';
|
|
|
|
|
@@ -362,17 +359,17 @@ THREE.Lut.prototype = {
|
|
|
if ( this.legend.layout == 'horizontal' ) {
|
|
|
|
|
|
var topPositionX = this.legend.position.x + ( this.legend.dimensions.height * 0.75 );
|
|
|
- var bottomPositionX = this.legend.position.x - ( this.legend.dimensions.width * 1.2 ) ;
|
|
|
+ var bottomPositionX = this.legend.position.x - ( this.legend.dimensions.width * 1.2 );
|
|
|
|
|
|
}
|
|
|
|
|
|
for ( var i = 0; i < this.legend.labels.ticks; i ++ ) {
|
|
|
|
|
|
- var value = ( this.maxV - this.minV ) / ( this.legend.labels.ticks - 1 ) * i + this.minV;
|
|
|
+ var value = ( this.maxV - this.minV ) / ( this.legend.labels.ticks - 1 ) * i + this.minV;
|
|
|
|
|
|
if ( callback ) {
|
|
|
|
|
|
- value = callback ( value );
|
|
|
+ value = callback( value );
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -394,9 +391,8 @@ THREE.Lut.prototype = {
|
|
|
contextTick.font = 'Normal ' + this.legend.labels.fontsize + 'px ' + this.legend.labels.fontface;
|
|
|
|
|
|
var metrics = contextTick.measureText( value.toString() );
|
|
|
- var textWidth = metrics.width;
|
|
|
|
|
|
- contextTick.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + backgroundColor.a + ')';
|
|
|
+ contextTick.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + backgroundColor.a + ')';
|
|
|
|
|
|
contextTick.strokeStyle = 'rgba(' + borderColor.r + ',' + borderColor.g + ',' + borderColor.b + ',' + borderColor.a + ')';
|
|
|
|
|
@@ -458,9 +454,9 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
var linePosition = ( this.legend.position.y - ( this.legend.dimensions.height * 0.5 ) + 0.01 ) + ( this.legend.dimensions.height ) * ( ( value - this.minV ) / ( this.maxV - this.minV ) * 0.99 );
|
|
|
|
|
|
- points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition, this.legend.position.z ) );
|
|
|
+ points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.55, linePosition, this.legend.position.z ) );
|
|
|
|
|
|
- points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.7, linePosition, this.legend.position.z ) );
|
|
|
+ points.push( new THREE.Vector3( this.legend.position.x + this.legend.dimensions.width * 0.7, linePosition, this.legend.position.z ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -468,9 +464,9 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
var linePosition = ( this.legend.position.x - ( this.legend.dimensions.height * 0.5 ) + 0.01 ) + ( this.legend.dimensions.height ) * ( ( value - this.minV ) / ( this.maxV - this.minV ) * 0.99 );
|
|
|
|
|
|
- points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.55, this.legend.position.z ) );
|
|
|
+ points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.55, this.legend.position.z ) );
|
|
|
|
|
|
- points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.7, this.legend.position.z ) );
|
|
|
+ points.push( new THREE.Vector3( linePosition, this.legend.position.y - this.legend.dimensions.width * 0.7, this.legend.position.z ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -485,7 +481,7 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- return { 'title': spriteTitle, 'ticks': ticks, 'lines': lines };
|
|
|
+ return { 'title': spriteTitle, 'ticks': ticks, 'lines': lines };
|
|
|
|
|
|
}
|
|
|
|
|
@@ -494,9 +490,9 @@ THREE.Lut.prototype = {
|
|
|
|
|
|
THREE.ColorMapKeywords = {
|
|
|
|
|
|
- "rainbow": [ [ 0.0, '0x0000FF' ], [ 0.2, '0x00FFFF' ], [ 0.5, '0x00FF00' ], [ 0.8, '0xFFFF00' ], [ 1.0, '0xFF0000' ] ],
|
|
|
- "cooltowarm": [ [ 0.0, '0x3C4EC2' ], [ 0.2, '0x9BBCFF' ], [ 0.5, '0xDCDCDC' ], [ 0.8, '0xF6A385' ], [ 1.0, '0xB40426' ] ],
|
|
|
- "blackbody" : [ [ 0.0, '0x000000' ], [ 0.2, '0x780000' ], [ 0.5, '0xE63200' ], [ 0.8, '0xFFFF00' ], [ 1.0, '0xFFFFFF' ] ],
|
|
|
- "grayscale" : [ [ 0.0, '0x000000' ], [ 0.2, '0x404040' ], [ 0.5, '0x7F7F80' ], [ 0.8, '0xBFBFBF' ], [ 1.0, '0xFFFFFF' ] ]
|
|
|
+ "rainbow": [[ 0.0, '0x0000FF' ], [ 0.2, '0x00FFFF' ], [ 0.5, '0x00FF00' ], [ 0.8, '0xFFFF00' ], [ 1.0, '0xFF0000' ]],
|
|
|
+ "cooltowarm": [[ 0.0, '0x3C4EC2' ], [ 0.2, '0x9BBCFF' ], [ 0.5, '0xDCDCDC' ], [ 0.8, '0xF6A385' ], [ 1.0, '0xB40426' ]],
|
|
|
+ "blackbody": [[ 0.0, '0x000000' ], [ 0.2, '0x780000' ], [ 0.5, '0xE63200' ], [ 0.8, '0xFFFF00' ], [ 1.0, '0xFFFFFF' ]],
|
|
|
+ "grayscale": [[ 0.0, '0x000000' ], [ 0.2, '0x404040' ], [ 0.5, '0x7F7F80' ], [ 0.8, '0xBFBFBF' ], [ 1.0, '0xFFFFFF' ]]
|
|
|
|
|
|
};
|