This commit is contained in:
11
src/main.ts
11
src/main.ts
@ -13,7 +13,7 @@ declare global {
|
||||
}
|
||||
|
||||
type InitParams = {
|
||||
container?: string;
|
||||
container?: string | HTMLCanvasElement;
|
||||
modelUrlList?: string[];
|
||||
apiConfig?: ConfiguratorParams;
|
||||
onSuccess?: () => void;
|
||||
@ -38,8 +38,15 @@ const kernel = {
|
||||
if (!params) { console.error('params is required'); return; }
|
||||
|
||||
mainApp = new MainApp();
|
||||
|
||||
const container = (typeof params.container === 'string'
|
||||
? (document.querySelector(params.container) || document.getElementById(params.container))
|
||||
: params.container || document.querySelector('#renderDom')) as HTMLCanvasElement | null;
|
||||
|
||||
if (!container) { throw new Error('Render canvas not found'); }
|
||||
|
||||
mainApp.loadAConfig({
|
||||
container: params.container || document.querySelector(params.container),
|
||||
container,
|
||||
modelUrlList: params.modelUrlList || [],
|
||||
env: params.env
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user