Skip to content

Commit 6aad768

Browse files
committed
revisit contextColor setup
1 parent 3a4d428 commit 6aad768

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/traces/parcoords/lines.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function emptyAttributes(regl) {
168168
return attributes;
169169
}
170170

171-
function makeItem(model, leftmost, rightmost, itemNumber, i0, i1, x, y, panelSizeX, panelSizeY, crossfilterDimensionIndex, constraints, drwLayer) {
171+
function makeItem(model, leftmost, rightmost, itemNumber, i0, i1, x, y, panelSizeX, panelSizeY, crossfilterDimensionIndex, drwLayer, constraints) {
172172
var dims = [[], []];
173173
for(var k = 0; k < 64; k++) {
174174
dims[0][k] = (k === i0) ? 1 : 0;
@@ -198,6 +198,12 @@ function makeItem(model, leftmost, rightmost, itemNumber, i0, i1, x, y, panelSiz
198198
dim1D: dims[1].slice(48, 64),
199199

200200
drwLayer: drwLayer,
201+
contextColor: [
202+
119 / 255,
203+
119 / 255,
204+
119 / 255,
205+
Math.max(1 / 255, Math.pow(1 / model.lines.color.length, 1 / 3))
206+
],
201207

202208
scissorX: (itemNumber === leftmost ? 0 : x + overdrag) + (model.pad.l - overdrag) + model.layoutWidth * domain.x[0],
203209
scissorWidth: (itemNumber === rightmost ? canvasWidth - x + overdrag : panelSizeX + 0.5) + (itemNumber === leftmost ? x + overdrag : 0),
@@ -326,7 +332,7 @@ module.exports = function(canvasGL, d) {
326332
loD: regl.prop('loD'),
327333
hiD: regl.prop('hiD'),
328334
palette: paletteTexture,
329-
contextOpacity: regl.prop('contextOpacity'),
335+
contextColor: regl.prop('contextColor'),
330336
mask: regl.prop('maskTexture'),
331337
drwLayer: regl.prop('drwLayer'),
332338
maskHeight: regl.prop('maskHeight')
@@ -403,7 +409,6 @@ module.exports = function(canvasGL, d) {
403409
else maskTexture = regl.texture(textureData);
404410

405411
return {
406-
contextOpacity: Math.max(1 / 255, Math.pow(1 / model.lines.color.length, 1 / 3)),
407412
maskTexture: maskTexture,
408413
maskHeight: maskHeight,
409414
loA: limits[0].slice(0, 16),
@@ -462,8 +467,8 @@ module.exports = function(canvasGL, d) {
462467
leftmost, rightmost, i, i0, i1, x, y,
463468
p.panelSizeX, p.panelSizeY,
464469
p.dim0.crossfilterDimensionIndex,
465-
constraints,
466-
isContext ? 0 : isPick ? 2 : 1
470+
isContext ? 0 : isPick ? 2 : 1,
471+
constraints
467472
);
468473

469474
renderState.clearOnly = clearOnly;

src/traces/parcoords/shaders/vertex.glsl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ uniform vec2 resolution, viewBoxPos, viewBoxSize;
1414
uniform sampler2D mask, palette;
1515
uniform float maskHeight;
1616
uniform float drwLayer; // 0: context, 1: focus, 2: pick
17-
uniform float contextOpacity;
17+
uniform vec4 contextColor;
1818

1919
bool isPick = (drwLayer > 1.5);
2020
bool isContext = (drwLayer < 0.5);
2121

22-
const vec3 contextColor = vec3(
23-
119.0 / 255.0,
24-
119.0 / 255.0,
25-
119.0 / 255.0
26-
);
27-
2822
const vec4 ZEROS = vec4(0.0, 0.0, 0.0, 0.0);
2923
const vec4 UNITS = vec4(1.0, 1.0, 1.0, 1.0);
3024

@@ -124,6 +118,6 @@ void main() {
124118
gl_Position = position(isContext, v, A, B, C, D);
125119

126120
fragColor =
127-
isContext ? vec4(contextColor, contextOpacity) :
121+
isContext ? vec4(contextColor) :
128122
isPick ? vec4(colors.rgb, 1.0) : texture2D(palette, vec2(abs(v), 0.5));
129123
}

0 commit comments

Comments
 (0)