Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ce752c

Browse files
committed
feat(core): fill catalogue with symbols from THREE automatically
1 parent 1641396 commit 3ce752c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

libs/core/src/lib/renderer/renderer.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,20 @@ export class NgtRenderer2 implements Renderer2 {
172172
return primitiveRendererNode;
173173
}
174174

175+
if (!name.startsWith('ngt-')) {
176+
return createRendererNode('platform', platformElement, this.document);
177+
}
178+
175179
const threeName = kebabToPascal(name.startsWith('ngt-') ? name.slice(4) : name);
176-
const threeTarget = this.catalogue[threeName];
180+
let threeTarget = this.catalogue[threeName];
181+
182+
if (!threeTarget && threeName in THREE) {
183+
const threeSymbol = THREE[threeName as keyof typeof THREE];
184+
if (typeof threeSymbol === 'function') {
185+
// we will attempt to prefill the catalogue with symbols from THREE
186+
threeTarget = this.catalogue[threeName] = threeSymbol as NgtConstructorRepresentation;
187+
}
188+
}
177189

178190
if (threeTarget) {
179191
const threeInstance = prepare(new threeTarget(...injectedArgs), name);

0 commit comments

Comments
 (0)