Skip to content

Commit

Permalink
Merge branch 'master' into nx_release
Browse files Browse the repository at this point in the history
  • Loading branch information
hkfb authored Sep 5, 2024
2 parents 500857d + d9ec035 commit 60713c9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 7 additions & 0 deletions typescript/packages/subsurface-viewer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [0.30.1](https://github.com/equinor/webviz-subsurface-components/compare/[email protected]@0.30.1) (2024-09-05)


### Bug Fixes

* **grid3d:** Fixed coloring if no property data proived ([#2224](https://github.com/equinor/webviz-subsurface-components/issues/2224)) ([3216861](https://github.com/equinor/webviz-subsurface-components/commit/3216861d1e2c24e70bee593836329429aa56ef3c))

# [0.30.0](https://github.com/equinor/webviz-subsurface-components/compare/[email protected]@0.30.0) (2024-09-04)


Expand Down
2 changes: 1 addition & 1 deletion typescript/packages/subsurface-viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webviz/subsurface-viewer",
"version": "0.30.0",
"version": "0.30.1",
"description": "3D visualization component for subsurface reservoir data",
"keywords": [
"subsurface",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ export default class Grid3DLayer extends CompositeLayer<Grid3DLayerProps> {

private getUndefinedPropertyValue(): number {
if (typeof this.props.undefinedPropertyValue === "number") {
return this.props.undefinedPropertyValue;
//Precision should be reduced to single for correct comparing property values
// with undefined property value in the webworker.
return new Float32Array([this.props.undefinedPropertyValue])[0];
}
if (this.props.propertiesData instanceof Uint16Array) {
return 0xffff;
Expand All @@ -421,8 +423,24 @@ export default class Grid3DLayer extends CompositeLayer<Grid3DLayerProps> {
}

private getUndefinedPropertyColor(): [number, number, number] {
const colorFunc = this.props.colorMapFunction;
if (
this.props.propertiesData.length === 0 &&
this.isColorMapFunctionConstantColor(colorFunc)
) {
return [colorFunc[0] / 255, colorFunc[1] / 255, colorFunc[2] / 255];
}
return this.props.undefinedPropertyColor ?? [0.8, 0.8, 0.8];
}

private isColorMapFunctionConstantColor(
colorFunc: Uint8Array | colorMapFunctionType | undefined
): colorFunc is Uint8Array {
return (
(Array.isArray(colorFunc) || colorFunc instanceof Uint8Array) &&
colorFunc.length >= 3
);
}
}

Grid3DLayer.layerName = "Grid3DLayer";
Expand Down

0 comments on commit 60713c9

Please sign in to comment.