Skip to content

Commit

Permalink
Fixed post-process editor
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-moreau committed Aug 28, 2018
1 parent ed0f79a commit dd43d49
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
9 changes: 5 additions & 4 deletions src/editor/components/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class EditorAssets {

// Empty or not
if (assets.length === 0) {
this.emptyTextNode = Tools.CreateElement<HTMLHeadElement>('h1', BabylonTools.RandomId(), {
const emptyTextNode = Tools.CreateElement<HTMLHeadElement>('h1', BabylonTools.RandomId(), {
'float': 'left',
'left': '50%',
'top': '50%',
Expand All @@ -147,9 +147,9 @@ export default class EditorAssets {
'font-family': 'Roboto,sans-serif !important',
'opacity': '0.5'
});
this.emptyTextNode.textContent = 'Empty';
emptyTextNode.textContent = 'Empty';

$('#' + c.id).append(this.emptyTextNode);
$('#' + c.id).append(emptyTextNode);
}

// Add elements
Expand Down Expand Up @@ -250,8 +250,9 @@ export default class EditorAssets {
else
$('#' + component.id).hide();

// Save component
// Save component and refresh
this.components.push(component);
this.refresh(component.id);
}

/**
Expand Down
7 changes: 5 additions & 2 deletions src/editor/gui/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class Dialog {
* @param title the title of the dialog
*/
public static CreateWithTextInput (title: string): Promise<string> {
return new Promise<string>((resolve) => {
return new Promise<string>((resolve, reject) => {
// Window
const popin = new Window('AskName');
popin.title = title;
Expand All @@ -56,7 +56,10 @@ export default class Dialog {
form.build('ASK-NAME-CREATE-DIALOG');

// Events
popin.onClose = () => form.element.destroy();
popin.onClose = () => {
form.element.destroy();
reject('User decided to not give an input');
};

popin.onButtonClick = id => {
if (!form.isValid())
Expand Down
13 changes: 6 additions & 7 deletions src/tools/post-process-editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,17 @@ export default class PostProcessEditor extends EditorPlugin {
* @param id the id of the selected item
*/
protected deletePostProcess (id: number): void {
const data = this.datas[id];

const p = this.createOrUpdatePostProcess(data.name);
p.dispose();
const p = this.createOrUpdatePostProcess(this.datas[id].name);
if (p)
p.dispose();

// Remove data
this.datas.splice(id, 1);
this.data = this.datas[0];

// Check if empty
if (this.datas.length === 0) {
if (this.data)
this.selectPostProcess(0);
else {
this.code.setValue('');
this.pixel.setValue('');
this.config.setValue('');
Expand Down Expand Up @@ -297,7 +297,6 @@ export default class PostProcessEditor extends EditorPlugin {

if (p.name === name) {
p.setConfig(JSON.parse(this.data.config));
p.userConfig = { };
this.editor.core.onSelectObject.notifyObservers(p);
return p;
}
Expand Down

0 comments on commit dd43d49

Please sign in to comment.