forked from mirror/ObjToSchematic
* Made material type switch button clearer if the material is textureable
* Made console log panel fully collapsable
This commit is contained in:
parent
8c7e56dced
commit
55780e6d18
@ -1,13 +1,15 @@
|
||||
import { MaterialType } from '../../mesh';
|
||||
import { MaterialType, SolidMaterial, TexturedMaterial } from '../../mesh';
|
||||
import { AppIcons } from '../icons';
|
||||
import { ConfigUIElement } from './config_element';
|
||||
import { ToolbarItemElement } from './toolbar_item';
|
||||
|
||||
export class MaterialTypeElement extends ConfigUIElement<MaterialType, HTMLDivElement> {
|
||||
private _switchElement: ToolbarItemElement;
|
||||
private _material: SolidMaterial | TexturedMaterial;
|
||||
|
||||
public constructor(material: MaterialType) {
|
||||
super(material);
|
||||
public constructor(material: SolidMaterial | TexturedMaterial) {
|
||||
super(material.type);
|
||||
this._material = material;
|
||||
this._switchElement = new ToolbarItemElement({ id: 'sw2', iconSVG: AppIcons.SWITCH })
|
||||
.setSmall()
|
||||
.setLabel('Switch')
|
||||
@ -35,6 +37,10 @@ export class MaterialTypeElement extends ConfigUIElement<MaterialType, HTMLDivEl
|
||||
`;
|
||||
}
|
||||
|
||||
public override finalise(): void {
|
||||
this._switchElement.setActive(this._material.type === MaterialType.solid && this._material.canBeTextured);
|
||||
}
|
||||
|
||||
public override registerEvents(): void {
|
||||
this._switchElement.registerEvents();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export class SolidMaterialElement extends ConfigUIElement<SolidMaterial, HTMLDiv
|
||||
this._materialName = materialName;
|
||||
this._colourId = getRandomID();
|
||||
|
||||
this._typeElement = new MaterialTypeElement(MaterialType.solid);
|
||||
this._typeElement = new MaterialTypeElement(material);
|
||||
|
||||
this._alphaElement = new SliderElement()
|
||||
.setMin(0.0)
|
||||
@ -47,6 +47,10 @@ export class SolidMaterialElement extends ConfigUIElement<SolidMaterial, HTMLDiv
|
||||
});
|
||||
}
|
||||
|
||||
public override finalise(): void {
|
||||
this._typeElement.finalise();
|
||||
}
|
||||
|
||||
protected override _generateInnerHTML(): string {
|
||||
const material = this.getValue();
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class TexturedMaterialElement extends ConfigUIElement<TexturedMaterial, H
|
||||
|
||||
this._imageElement = new ImageElement(material.diffuse);
|
||||
|
||||
this._typeElement = new MaterialTypeElement(MaterialType.textured);
|
||||
this._typeElement = new MaterialTypeElement(material);
|
||||
|
||||
switch (material.transparency.type) {
|
||||
case 'UseAlphaValue':
|
||||
|
@ -486,11 +486,11 @@ export class UI {
|
||||
Split(['.column-sidebar', '.column-canvas'], {
|
||||
sizes: [20, 80],
|
||||
minSize: [400, 500],
|
||||
snapOffset: 0,
|
||||
});
|
||||
|
||||
Split(['.column-properties', '.column-console'], {
|
||||
sizes: [90, 10],
|
||||
minSize: [0, 0],
|
||||
direction: 'vertical',
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user