diff --git a/src/importers/obj_importer.ts b/src/importers/obj_importer.ts index 71b6bb0..0b9af56 100644 --- a/src/importers/obj_importer.ts +++ b/src/importers/obj_importer.ts @@ -276,8 +276,6 @@ export class ObjImporter extends IImporter { ]; override parseFile(filePath: string) { - ASSERT(path.isAbsolute(filePath), `ObjImporter: ${filePath} not absolute`); - this._objPath = path.parse(filePath); this._parseOBJ(filePath); @@ -302,8 +300,11 @@ export class ObjImporter extends IImporter { } private _parseOBJ(path: string) { + if (path === '') { + throw new AppError(`No filepath given`); + } if (!fs.existsSync(path)) { - throw new AppError(`Could not find ${path}`); + throw new AppError(`Could not find '${path}'`); } const fileContents = fs.readFileSync(path, 'utf8'); if (fileContents.includes('�')) { diff --git a/src/ui/elements/file_input.ts b/src/ui/elements/file_input.ts index d3e5aec..8083b64 100644 --- a/src/ui/elements/file_input.ts +++ b/src/ui/elements/file_input.ts @@ -9,7 +9,7 @@ export class FileInputElement extends ConfigUIElement { private _hovering: boolean; public constructor() { - super(); + super(''); this._fileExtensions = []; this._loadedFilePath = ''; this._hovering = false; diff --git a/src/ui/elements/output.ts b/src/ui/elements/output.ts index 6d5ce64..14d7461 100644 --- a/src/ui/elements/output.ts +++ b/src/ui/elements/output.ts @@ -60,6 +60,7 @@ export class OutputElement { ASSERT(element !== null); element.innerHTML = this._message.toString(); + this._message.postBuild(); } public setStyle(style: OutputStyle) { diff --git a/src/ui/misc.ts b/src/ui/misc.ts index aa1a05d..94bd36a 100644 --- a/src/ui/misc.ts +++ b/src/ui/misc.ts @@ -74,6 +74,16 @@ export class UITreeBuilder implements IUIOutputElement { this._postBuildDelegates.forEach((delegate) => { delegate(); }); + + const toggler = document.getElementsByClassName('caret') as HTMLCollectionOf; + + for (let i = 0; i < toggler.length; i++) { + const temp = toggler[i]; + temp.onclick = () => { + temp.parentElement?.querySelector('.nested')?.classList.toggle('active'); + temp.classList.toggle('caret-down'); + }; + } } public buildHTML(): string {