mirror of
https://github.com/LucasDower/ObjToSchematic.git
synced 2024-11-27 02:19:58 +08:00
Fixed UI tree element not expanding/collapsing
Fixed error message when loading a mesh with an empty filepath
This commit is contained in:
parent
8b0ce63afc
commit
eda39d771b
@ -276,8 +276,6 @@ export class ObjImporter extends IImporter {
|
|||||||
];
|
];
|
||||||
|
|
||||||
override parseFile(filePath: string) {
|
override parseFile(filePath: string) {
|
||||||
ASSERT(path.isAbsolute(filePath), `ObjImporter: ${filePath} not absolute`);
|
|
||||||
|
|
||||||
this._objPath = path.parse(filePath);
|
this._objPath = path.parse(filePath);
|
||||||
|
|
||||||
this._parseOBJ(filePath);
|
this._parseOBJ(filePath);
|
||||||
@ -302,8 +300,11 @@ export class ObjImporter extends IImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _parseOBJ(path: string) {
|
private _parseOBJ(path: string) {
|
||||||
|
if (path === '') {
|
||||||
|
throw new AppError(`No filepath given`);
|
||||||
|
}
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
throw new AppError(`Could not find ${path}`);
|
throw new AppError(`Could not find '${path}'`);
|
||||||
}
|
}
|
||||||
const fileContents = fs.readFileSync(path, 'utf8');
|
const fileContents = fs.readFileSync(path, 'utf8');
|
||||||
if (fileContents.includes('<27>')) {
|
if (fileContents.includes('<27>')) {
|
||||||
|
@ -9,7 +9,7 @@ export class FileInputElement extends ConfigUIElement<string, HTMLDivElement> {
|
|||||||
private _hovering: boolean;
|
private _hovering: boolean;
|
||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
super();
|
super('');
|
||||||
this._fileExtensions = [];
|
this._fileExtensions = [];
|
||||||
this._loadedFilePath = '';
|
this._loadedFilePath = '';
|
||||||
this._hovering = false;
|
this._hovering = false;
|
||||||
|
@ -60,6 +60,7 @@ export class OutputElement {
|
|||||||
ASSERT(element !== null);
|
ASSERT(element !== null);
|
||||||
|
|
||||||
element.innerHTML = this._message.toString();
|
element.innerHTML = this._message.toString();
|
||||||
|
this._message.postBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setStyle(style: OutputStyle) {
|
public setStyle(style: OutputStyle) {
|
||||||
|
@ -74,6 +74,16 @@ export class UITreeBuilder implements IUIOutputElement {
|
|||||||
this._postBuildDelegates.forEach((delegate) => {
|
this._postBuildDelegates.forEach((delegate) => {
|
||||||
delegate();
|
delegate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const toggler = document.getElementsByClassName('caret') as HTMLCollectionOf<HTMLElement>;
|
||||||
|
|
||||||
|
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 {
|
public buildHTML(): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user