diff --git a/typescript/packages/subsurface-viewer/src/SubsurfaceViewer.tsx b/typescript/packages/subsurface-viewer/src/SubsurfaceViewer.tsx index e17b3086b..6f701d760 100644 --- a/typescript/packages/subsurface-viewer/src/SubsurfaceViewer.tsx +++ b/typescript/packages/subsurface-viewer/src/SubsurfaceViewer.tsx @@ -13,6 +13,7 @@ import PropTypes from "prop-types"; import type { colorTablesArray } from "@emerson-eps/color-tables/"; import type { Unit } from "convert-units"; import convert from "convert-units"; +import type { PickingInfo } from "@deck.gl/core/typed"; export type { BoundsAccessor, @@ -99,7 +100,7 @@ export interface SubsurfaceViewerProps { */ isLoadedCallback?: (arg: boolean) => void; - onDragStart?: (info: unknown, event: unknown) => void; + onDragStart?: (info: PickingInfo, event: unknown) => void; onDragEnd?: (info: unknown, event: unknown) => void; /** diff --git a/typescript/packages/subsurface-viewer/src/components/Map.tsx b/typescript/packages/subsurface-viewer/src/components/Map.tsx index 96357f6bf..540cbd745 100644 --- a/typescript/packages/subsurface-viewer/src/components/Map.tsx +++ b/typescript/packages/subsurface-viewer/src/components/Map.tsx @@ -397,8 +397,8 @@ export interface MapProps { */ isLoadedCallback?: (arg: boolean) => void; - onDragStart?: (info: unknown, event: unknown) => void; - onDragEnd?: (info: unknown, event: unknown) => void; + onDragStart?: (info: PickingInfo, event: unknown) => void; + onDragEnd?: (info: PickingInfo, event: unknown) => void; /** * If changed will reset camera to default position. diff --git a/typescript/packages/subsurface-viewer/src/layers/wells/utils/spline.ts b/typescript/packages/subsurface-viewer/src/layers/wells/utils/spline.ts index 548d38d73..eb3dce665 100644 --- a/typescript/packages/subsurface-viewer/src/layers/wells/utils/spline.ts +++ b/typescript/packages/subsurface-viewer/src/layers/wells/utils/spline.ts @@ -260,10 +260,7 @@ export function coarsenWells(data_in: FeatureCollection): FeatureCollection { return index === 0 || index === array.length - 1 || index % 10 == 0; }; - ( - (data.features[well_no].geometry as GeometryCollection) - .geometries[1] as LineString - ).coordinates = coords.filter(filterFunc); + lineString.coordinates = coords.filter(filterFunc); if (data.features[well_no].properties) { data.features[well_no].properties!["md"] = mds.filter(filterFunc); diff --git a/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.stories.tsx b/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.stories.tsx index c1eea1f8f..71ef79a12 100644 --- a/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.stories.tsx +++ b/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.stories.tsx @@ -11,6 +11,9 @@ import { colorTables, } from "@emerson-eps/color-tables"; import type { MapMouseEvent } from "../../components/Map"; +import WellsLayer from "./wellsLayer"; +import AxesLayer from "../axes/axesLayer"; + const PREFIX = "VolveWells"; const classes = { @@ -446,19 +449,17 @@ export const Wells3DGullfaks: ComponentStory = ( onDragStart: () => setOptimizedInteraction(true), onDragEnd: () => setOptimizedInteraction(false), layers: [ - { - "@@type": "WellsLayer", - data: "@@#resources.wellsData", + new WellsLayer({ + data: "./gullfaks.json", wellHeadStyle: { size: 4 }, refine: true, outline: true, optimizedInteraction, // If true will cause wellslayer to draw simplified. - }, - { - "@@type": "AxesLayer", + }), + new AxesLayer({ id: "axes-layer", bounds: [450000, 6781000, 0, 464000, 6791000, 3500], - }, + }), ], }; @@ -467,9 +468,6 @@ export const Wells3DGullfaks: ComponentStory = ( Wells3DGullfaks.args = { id: "gullfaks", - resources: { - wellsData: "./gullfaks.json", - }, bounds: [450000, 6781000, 464000, 6791000] as [ number, number, diff --git a/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts b/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts index b57b4604b..260a6f738 100644 --- a/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts +++ b/typescript/packages/subsurface-viewer/src/layers/wells/wellsLayer.ts @@ -104,7 +104,7 @@ export interface WellsLayerProps extends ExtendedLayerProps { */ ZIncreasingDownwards: boolean; /** If true means that a simplified representation of the wells will be drawn. - * Useful for example during panning and roation to gain speed. + * Useful for example during panning and rotation to gain speed. */ optimizedInteraction: boolean; } @@ -382,7 +382,7 @@ export default class WellsLayer extends CompositeLayer { }; // Reduced details when rotating or panning the view if "optimizedInteraction" is set. - const drawSimple = this.props.optimizedInteraction; + const fastDrawing = this.props.optimizedInteraction; const simpleLayer = new UnfoldedGeoJsonLayer( this.getSubLayerProps({ @@ -406,7 +406,7 @@ export default class WellsLayer extends CompositeLayer { lineBillboard: false, pointBillboard: false, parameters, - visible: drawSimple, + visible: fastDrawing, }) ); const outlineLayer = new UnfoldedGeoJsonLayer( @@ -427,7 +427,7 @@ export default class WellsLayer extends CompositeLayer { lineBillboard: true, pointBillboard: true, parameters, - visible: this.props.outline && !drawSimple, + visible: this.props.outline && !fastDrawing, }) ); @@ -459,7 +459,7 @@ export default class WellsLayer extends CompositeLayer { lineBillboard: true, pointBillboard: true, parameters, - visible: !drawSimple, + visible: !fastDrawing, }) ); @@ -487,12 +487,12 @@ export default class WellsLayer extends CompositeLayer { getFillColor: getColor(this.props.wellHeadStyle?.color), getLineColor: getColor(this.props.lineStyle?.color), parameters, - visible: this.props.logCurves && !drawSimple, + visible: this.props.logCurves && !fastDrawing, }) ); // Highlight the multi selected wells. - const highlightMultiWells_layer = new UnfoldedGeoJsonLayer( + const highlightMultiWellsLayer = new UnfoldedGeoJsonLayer( this.getSubLayerProps({ id: "highlight2", data: getWellObjectsByName( @@ -515,7 +515,7 @@ export default class WellsLayer extends CompositeLayer { getFillColor: [255, 140, 0], getLineColor: [255, 140, 0], parameters, - visible: this.props.logCurves && !drawSimple, + visible: this.props.logCurves && !fastDrawing, }) ); @@ -569,7 +569,7 @@ export default class WellsLayer extends CompositeLayer { this.setLegend(value); }, parameters, - visible: this.props.logCurves && !drawSimple, + visible: this.props.logCurves && !fastDrawing, }) ); @@ -624,7 +624,7 @@ export default class WellsLayer extends CompositeLayer { this.setLegend(value); }, parameters, - visible: this.props.logCurves && !drawSimple, + visible: this.props.logCurves && !fastDrawing, }) ); @@ -646,7 +646,7 @@ export default class WellsLayer extends CompositeLayer { getAlignmentBaseline: "bottom", getSize: this.props.wellNameSize, parameters, - visible: this.props.wellNameVisible && !drawSimple, + visible: this.props.wellNameVisible && !fastDrawing, }) ); @@ -656,7 +656,7 @@ export default class WellsLayer extends CompositeLayer { logLayer, colorsLayer, highlightLayer, - highlightMultiWells_layer, + highlightMultiWellsLayer, selectionLayer, namesLayer, ];