Skip to content

Commit

Permalink
Merge pull request #98 from ux3d/fix/dropGltfUINameUpdate
Browse files Browse the repository at this point in the history
dropping a gltf now updates the UI (GSVN-159)
  • Loading branch information
UX3D-becher authored Jan 25, 2021
2 parents c9441e2 + 5af3d29 commit 338c221
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app_web/src/logic/uimodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,32 @@ class UIModel
this.hdr = inputObservables.hdrDropped;

this.variant = app.variantChanged$.pipe(pluck("event", "msg"));

this.model.subscribe(() => {
// remove last filename
if(this.app.models[this.app.models.length -1] === this.lastDroppedFilename)
{
this.app.models.pop();
this.lastDroppedFilename = undefined;
}
});

const dropedFileName = inputObservables.gltfDropped.pipe(
map( (data) => {
return data.mainFile.name;
})
);
dropedFileName.subscribe( (filename) => {
if(filename !== undefined)
{
filename = filename.split('/').pop();
filename = filename.substr(0, filename.lastIndexOf('.'));

this.app.models.push(filename);
this.app.selectedModel = filename;
this.lastDroppedFilename = filename;
}
});
}

static getInputObservables(inputDomElement)
Expand Down

0 comments on commit 338c221

Please sign in to comment.