Skip to content

Commit

Permalink
feat(grid3d): prop to show-hide grid lines added (#1624)
Browse files Browse the repository at this point in the history
* feat(grid3d): prop to show-hide grid lines added

* docs(grid3d): descr of gridLines prop updated

---------

Co-authored-by: Leonid Polukhin <leonid.polukhin@aspentech.com>
  • Loading branch information
LeonidPolukhin and Leonid Polukhin committed Aug 2, 2023
1 parent 2529360 commit 0b22788
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const defaultProps = {
const grid3dLayer = {
"@@type": "Grid3DLayer",
id: "Grid3DLayer",
gridLines: true,
material: true,
colorMapName: "Rainbow",
ZIncreasingDownwards: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export interface Grid3DLayerProps extends ExtendedLayerProps {
*/
colorMapFunction?: colorMapFunctionType | false;

/** Enable lines around cell faces.
* default: true.
*/
gridLines: boolean;

/** Surface material properties.
* material: true = default material, coloring depends on surface orientation and lighting.
* false = no material, coloring is independent on surface orientation and lighting.
Expand Down Expand Up @@ -133,6 +138,7 @@ const defaultProps = {
visible: true,
material: true,
colorMapName: "",
gridLines: true,
propertyValueRange: [0.0, 1.0],
depthTest: true,
ZIncreasingDownwards: true,
Expand Down Expand Up @@ -258,6 +264,7 @@ export default class Grid3DLayer extends CompositeLayer<Grid3DLayerProps> {
colorMapRange: this.props.colorMapRange,
colorMapClampColor: this.props.colorMapClampColor,
colorMapFunction: this.props.colorMapFunction,
gridLines: this.props.gridLines,
propertyValueRange: this.state["propertyValueRange"],
material: this.props.material,
depthTest: this.props.depthTest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface privateLayerProps extends ExtendedLayerProps {
colorMapRange: [number, number];
colorMapClampColor: Color | undefined | boolean;
colorMapFunction?: colorMapFunctionType | false;
gridLines: boolean;
propertyValueRange: [number, number];
depthTest: boolean;
}
Expand Down Expand Up @@ -247,7 +248,9 @@ export default class privateLayer extends Layer<privateLayerProps> {
gl.disable(gl.POLYGON_OFFSET_FILL);

// Draw lines.
mesh_lines_model.draw();
if (this.props.gridLines) {
mesh_lines_model.draw();
}

if (!this.props.depthTest) {
gl.enable(gl.DEPTH_TEST);
Expand Down

0 comments on commit 0b22788

Please sign in to comment.