Skip to content

Commit 49aa746

Browse files
committed
reduced color attributes
1 parent 4ac90eb commit 49aa746

File tree

3 files changed

+4
-57
lines changed

3 files changed

+4
-57
lines changed

src/traces/isosurface/attributes.js

-25
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,6 @@ module.exports = extendFlat({
9292
].join(' ')
9393
},
9494

95-
// Color field
96-
color: {
97-
valType: 'color',
98-
role: 'style',
99-
editType: 'calc',
100-
description: 'Sets the color of the whole isosurface'
101-
},
102-
vertexcolor: {
103-
valType: 'data_array',
104-
role: 'style',
105-
editType: 'calc',
106-
description: [
107-
'Sets the color of each vertex',
108-
'Overrides *color*.'
109-
].join(' ')
110-
},
111-
facecolor: {
112-
valType: 'data_array',
113-
role: 'style',
114-
editType: 'calc',
115-
description: [
116-
'Sets the color of each face',
117-
'Overrides *color* and *vertexcolor*.'
118-
].join(' ')
119-
},
12095
transforms: undefined
12196
},
12297

src/traces/isosurface/convert.js

+3-23
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function IsosurfaceTrace(scene, mesh, uid) {
2121
this.uid = uid;
2222
this.mesh = mesh;
2323
this.name = '';
24-
this.color = '#fff';
2524
this.data = null;
2625
this.showContour = false;
2726
}
@@ -49,10 +48,6 @@ proto.handlePick = function(selection) {
4948
}
5049
};
5150

52-
function parseColorArray(colors) {
53-
return colors.map(str2RgbaArray);
54-
}
55-
5651
proto.update = function(data) {
5752
var scene = this.scene,
5853
layout = scene.fullSceneLayout;
@@ -91,24 +86,9 @@ proto.update = function(data) {
9186
useFacetNormals: data.flatshading
9287
};
9388

94-
if(data.intensity) {
95-
this.color = '#fff';
96-
config.vertexIntensity = data.intensity;
97-
config.vertexIntensityBounds = [data.cmin, data.cmax];
98-
config.colormap = parseColorScale(data.colorscale);
99-
}
100-
else if(data.vertexcolor) {
101-
this.color = data.vertexcolor[0];
102-
config.vertexColors = parseColorArray(data.vertexcolor);
103-
}
104-
else if(data.facecolor) {
105-
this.color = data.facecolor[0];
106-
config.cellColors = parseColorArray(data.facecolor);
107-
}
108-
else {
109-
this.color = data.color;
110-
config.meshColor = str2RgbaArray(data.color);
111-
}
89+
config.vertexIntensity = data.intensity;
90+
config.vertexIntensityBounds = [data.cmin, data.cmax];
91+
config.colormap = parseColorScale(data.colorscale);
11292

11393
// Update mesh
11494
this.mesh.update(config);

src/traces/isosurface/defaults.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,5 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
6363
'opacity'
6464
].forEach(function(x) { coerce(x); });
6565

66-
if('colorscale' in traceIn) {
67-
colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'});
68-
} else {
69-
traceOut.showscale = false;
70-
71-
if('facecolor' in traceIn) coerce('facecolor');
72-
else if('vertexcolor' in traceIn) coerce('vertexcolor');
73-
else coerce('color', defaultColor);
74-
}
66+
colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'});
7567
};

0 commit comments

Comments
 (0)