mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
LT21: shapeFromChildren reads a Text3D's and a BufferMesh's props as their own types again, one if per type, so tools/sdk-props sees BufferMesh's seven props read (positions, normals, uvs, colors, indices, attributes, copies: 0 unread). The fragment-aware loop is kept: a shape inside a fragment is still the mesh's shape (conformance/detail.test.tsx).
This commit is contained in:
1 parent
a3fec64205
commit
df8c577fc3
1 file changed
+7
-2
@@ -448,8 +448,13 @@ const flat = (kids: ReactNode): ReactElement[] => Children.toArray(kids).flatMap
|
||||
|
||||
export function shapeFromChildren(children: ReactNode): string | undefined {
|
||||
for (const child of flat(children)) {
|
||||
const props = child.props as Record<string, unknown>;
|
||||
const s = child.type === Text3D ? text3dShape(props as unknown as Text3DProps) : child.type === BufferMesh ? bufferShape(props as unknown as BufferMeshProps) : GEOMETRY_SHAPES.get(child.type)?.(props);
|
||||
if (child.type === Text3D) {
|
||||
return text3dShape((child as ReactElement<Text3DProps>).props);
|
||||
}
|
||||
if (child.type === BufferMesh) {
|
||||
return bufferShape((child as ReactElement<BufferMeshProps>).props);
|
||||
}
|
||||
const s = GEOMETRY_SHAPES.get(child.type)?.((child as ReactElement<Record<string, unknown>>).props);
|
||||
if (s !== undefined) return s;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in new issue
Block a user