diff --git a/typescript/packages/subsurface-viewer/src/components/Map.tsx b/typescript/packages/subsurface-viewer/src/components/Map.tsx index eab43bf881..8b1f78ab6a 100644 --- a/typescript/packages/subsurface-viewer/src/components/Map.tsx +++ b/typescript/packages/subsurface-viewer/src/components/Map.tsx @@ -668,19 +668,26 @@ const Map: React.FC = ({ layers.push(dummy_layer); } - const m = getModelMatrixScale(zScale); - return layers.map((item) => { if (item?.constructor.name === NorthArrow3DLayer.name) { return item; } + let m: Matrix4; + if ((item as Layer).props.modelMatrix) { + m = (item as Layer).props.modelMatrix as Matrix4; + m[10] *= zScale; // Z scaling element of matrix. + } else { + m = getModelMatrixScale(zScale); + } + return (item as Layer).clone({ // Inject "dispatchBoundingBox" function into layer for it to report back its respective bounding box. // eslint-disable-next-line // @ts-ignore reportBoundingBox: dispatchBoundingBox, - // Set "modelLayer" matrix to reflect correct z scaling. + + // Modify "modelMatrix" to reflect correct z scaling. modelMatrix: m, }); });