Skip to content

Commit 04bb780

Browse files
nilscbw1nklr
andauthored
fix: Fix model matrix (#2513)
Co-authored-by: t0oF <[email protected]>
1 parent fc78193 commit 04bb780

File tree

1 file changed

+10
-3
lines changed
  • typescript/packages/subsurface-viewer/src/components

1 file changed

+10
-3
lines changed

typescript/packages/subsurface-viewer/src/components/Map.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,19 +668,26 @@ const Map: React.FC<MapProps> = ({
668668
layers.push(dummy_layer);
669669
}
670670

671-
const m = getModelMatrixScale(zScale);
672-
673671
return layers.map((item) => {
674672
if (item?.constructor.name === NorthArrow3DLayer.name) {
675673
return item;
676674
}
677675

676+
let m: Matrix4;
677+
if ((item as Layer).props.modelMatrix) {
678+
m = (item as Layer).props.modelMatrix as Matrix4;
679+
m[10] *= zScale; // Z scaling element of matrix.
680+
} else {
681+
m = getModelMatrixScale(zScale);
682+
}
683+
678684
return (item as Layer).clone({
679685
// Inject "dispatchBoundingBox" function into layer for it to report back its respective bounding box.
680686
// eslint-disable-next-line
681687
// @ts-ignore
682688
reportBoundingBox: dispatchBoundingBox,
683-
// Set "modelLayer" matrix to reflect correct z scaling.
689+
690+
// Modify "modelMatrix" to reflect correct z scaling.
684691
modelMatrix: m,
685692
});
686693
});

0 commit comments

Comments
 (0)