Update face material index handling in viewport-host.ts

This commit is contained in:
2026-04-15 07:59:27 +02:00
parent 5f6fa6c3c3
commit ddeb859b93

View File

@@ -5776,9 +5776,10 @@ export class ViewportHost {
if (this.whiteboxSelectionMode === "face") {
const faceMaterialIndex = hit.face?.materialIndex;
const renderObjects = this.brushRenderObjects.get(brushId);
const faceId =
typeof faceMaterialIndex === "number"
? (BOX_FACE_IDS[faceMaterialIndex] ?? null)
typeof faceMaterialIndex === "number" && renderObjects !== undefined
? (renderObjects.faceIdsInOrder[faceMaterialIndex] ?? null)
: null;
if (faceId === null) {