fix: texture mapping in JuiceBox and node deletion bug in hierarchy
Build and Deploy / build-and-push (push) Failing after 20s

This commit is contained in:
AI Bot
2026-09-02 10:05:44 +05:30
parent 35c688ba47
commit 7582d9b810
3 changed files with 32 additions and 2 deletions
+6 -1
View File
@@ -62,6 +62,10 @@ export const JuiceBox = forwardRef<THREE.Group, any>(({
ctx.fillText("REFRESHING FRUIT DRINK", 256, 150); ctx.fillText("REFRESHING FRUIT DRINK", 256, 150);
} }
const tex = new THREE.CanvasTexture(canvas); const tex = new THREE.CanvasTexture(canvas);
tex.colorSpace = THREE.SRGBColorSpace;
tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
tex.repeat.set(-1, -1);
tex.offset.set(1, 1);
tex.needsUpdate = true; tex.needsUpdate = true;
return tex; return tex;
}, [color, map]); }, [color, map]);
@@ -72,7 +76,8 @@ export const JuiceBox = forwardRef<THREE.Group, any>(({
const tex = loader.load(map); const tex = loader.load(map);
tex.colorSpace = THREE.SRGBColorSpace; tex.colorSpace = THREE.SRGBColorSpace;
tex.wrapS = tex.wrapT = THREE.RepeatWrapping; tex.wrapS = tex.wrapT = THREE.RepeatWrapping;
tex.repeat.set(uvScale, uvScale); tex.repeat.set(-uvScale, -uvScale);
tex.offset.set(1, 1);
return tex; return tex;
}, [map, uvScale]); }, [map, uvScale]);
+12
View File
@@ -244,6 +244,18 @@ export const ModelViewer = forwardRef<THREE.Group, ModelViewerProps>(({ object,
} }
}, [object, sceneObjects]); }, [object, sceneObjects]);
// Hide deleted meshes
useEffect(() => {
if (object && sceneObjects) {
const activeIds = new Set(sceneObjects.map(obj => obj.id));
meshCache.current.forEach((mesh, id) => {
if (!activeIds.has(id)) {
mesh.visible = false;
}
});
}
}, [object, sceneObjects]);
if (!object) return null; if (!object) return null;
const meshObjects = sceneObjects.filter(obj => obj.type === 'mesh'); const meshObjects = sceneObjects.filter(obj => obj.type === 'mesh');
+14 -1
View File
@@ -1715,7 +1715,20 @@ export default function Editor() {
}; };
const deleteObjects = () => { const deleteObjects = () => {
updateSceneObjects(prev => prev.filter(obj => !selectedIds.includes(obj.id))); updateSceneObjects(prev => {
let idsToDelete = [...selectedIds];
let added = true;
while (added) {
added = false;
prev.forEach(obj => {
if (obj.parentId && idsToDelete.includes(obj.parentId) && !idsToDelete.includes(obj.id)) {
idsToDelete.push(obj.id);
added = true;
}
});
}
return prev.filter(obj => !idsToDelete.includes(obj.id));
});
setSelectedIds([]); setSelectedIds([]);
}; };