Skip to content

Commit 2ace3b8

Browse files
committed
[NGRM] - Map layer z scaling witth arrow keys not functioning properly if modelMatrix propert is set #2512
1 parent 476ce3a commit 2ace3b8

File tree

1 file changed

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

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,20 +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,
683689

684-
// Set "modelLayer" matrix to reflect correct z scaling.
690+
// Modify "modelMatrix" to reflect correct z scaling.
685691
modelMatrix: m,
686692
});
687693
});

0 commit comments

Comments
 (0)