From 46176b7b87ef9ae86dfe119d8eb87902d316a90f Mon Sep 17 00:00:00 2001 From: Ruben Thoms <69145689+rubenthoms@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:22:15 +0200 Subject: [PATCH] fix: incorrect interface of `ColormapLayer` (#2314) Closes #2310. --- .../src/layers/colormap/colormapLayer.ts | 9 +++++++-- .../subsurface-viewer/src/layers/utils/layerTools.ts | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/typescript/packages/subsurface-viewer/src/layers/colormap/colormapLayer.ts b/typescript/packages/subsurface-viewer/src/layers/colormap/colormapLayer.ts index 4c3d4868ff..3f7bb6b92e 100644 --- a/typescript/packages/subsurface-viewer/src/layers/colormap/colormapLayer.ts +++ b/typescript/packages/subsurface-viewer/src/layers/colormap/colormapLayer.ts @@ -2,7 +2,10 @@ import type { BitmapLayerPickingInfo, BitmapLayerProps } from "@deck.gl/layers"; import { BitmapLayer } from "@deck.gl/layers"; import type { PickingInfo } from "@deck.gl/core"; -import type { LayerPickInfo } from "../../layers/utils/layerTools"; +import type { + LayerPickInfo, + TypeAndNameLayerProps, +} from "../../layers/utils/layerTools"; import { decoder } from "../shader_modules"; import type { ValueDecoder } from "../utils/propertyMapTools"; import { decodeRGB } from "../utils/propertyMapTools"; @@ -66,7 +69,9 @@ function getImageData( // and RGB(255, 255, 255) to the maximum value in valueRange, thus giving us the full // > 16mil possible values for any property value range. // We also support property maps with an alpha channel. See colormap.fs.glsl for more details. -export interface ColormapLayerProps extends BitmapLayerProps { +export interface ColormapLayerProps + extends BitmapLayerProps, + TypeAndNameLayerProps { // Name of color map. colorMapName: string; diff --git a/typescript/packages/subsurface-viewer/src/layers/utils/layerTools.ts b/typescript/packages/subsurface-viewer/src/layers/utils/layerTools.ts index 9869c59274..f19f1e9acf 100644 --- a/typescript/packages/subsurface-viewer/src/layers/utils/layerTools.ts +++ b/typescript/packages/subsurface-viewer/src/layers/utils/layerTools.ts @@ -22,11 +22,15 @@ export type Position3D = [number, number, number]; // Return a color given a number in the [0,1] range. export type colorMapFunctionType = (x: number) => [number, number, number]; -export interface ExtendedLayerProps extends CompositeLayerProps { +export interface TypeAndNameLayerProps { "@@type"?: string; name: string; } +export interface ExtendedLayerProps + extends CompositeLayerProps, + TypeAndNameLayerProps {} + export interface ExtendedLayer extends Layer { getLegendData?: () => DiscreteLegendDataType | ContinuousLegendDataType; }