Skip to content

Commit

Permalink
fix: color of undefined value for 3D grids is incorrect (#2253)
Browse files Browse the repository at this point in the history
The color was way to clear, and was missing the 0-255 to 0-1 conversion.
  • Loading branch information
w1nklr authored Sep 23, 2024
1 parent 4c27540 commit d53b213
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ export default class Grid3DLayer extends CompositeLayer<Grid3DLayerProps> {
this.props.propertiesData.length === 0 &&
this.isColorMapFunctionConstantColor(colorFunc)
) {
return [colorFunc[0] / 255, colorFunc[1] / 255, colorFunc[2] / 255];
return [colorFunc[0], colorFunc[1], colorFunc[2]];
}
return this.props.undefinedPropertyColor ?? [0.8, 0.8, 0.8];
return this.props.undefinedPropertyColor ?? [204, 204, 204];
}

private isColorMapFunctionConstantColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ export default class PrivateLayer extends Layer<PrivateLayerProps> {
const colorMapClampColorUniform = colorMapClampColor.map(
(x) => (x ?? 0) / 255
);

const undefinedPropertyColorUniform =
this.props.undefinedPropertyColor.map((x) => (x ?? 0) / 255) as [
number,
number,
number,
];

const isColorMapClampColorTransparent: boolean =
(this.props.colorMapClampColor as boolean) === false;

Expand All @@ -362,7 +370,7 @@ export default class PrivateLayer extends Layer<PrivateLayerProps> {
valueRangeMax,
colorMapRangeMin,
colorMapRangeMax,
undefinedPropertyColor: this.props.undefinedPropertyColor,
undefinedPropertyColor: undefinedPropertyColorUniform,
colorMapClampColor: Array.from(colorMapClampColorUniform),
isColorMapClampColorTransparent,
isClampColor,
Expand Down

0 comments on commit d53b213

Please sign in to comment.