annotate widget with filename, when available
This commit is contained in:
parent
94ba119543
commit
21b0e2b9d5
4 changed files with 20 additions and 6 deletions
|
|
@ -1140,16 +1140,19 @@
|
|||
} else {
|
||||
ajax(url, function(vertices) {
|
||||
vertices = js2o(vertices).toFloat32();
|
||||
platform.add(newWidget().loadVertices(vertices));
|
||||
if (onload) onload(vertices);
|
||||
let widget = newWidget().loadVertices(vertices);
|
||||
platform.add(widget);
|
||||
if (onload) onload(vertices, widget);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function platformLoadSTL(url, onload) {
|
||||
new MOTO.STL().load(url, function(vertices) {
|
||||
platform.add(newWidget().loadVertices(vertices));
|
||||
if (onload) onload(vertices);
|
||||
new MOTO.STL().load(url, function(vertices, filename) {
|
||||
let widget = newWidget().loadVertices(vertices);
|
||||
widget.filename = filename;
|
||||
platform.add(widget);
|
||||
if (onload) onload(vertices, widget);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@
|
|||
PRO.saveToCatalog = function(filename) {
|
||||
let widget = this;
|
||||
let time = UTIL.time();
|
||||
widget.filename = filename;
|
||||
KIRI.catalog.putFile(filename, this.getGeoVertices(), function(vertices) {
|
||||
if (vertices && vertices.length) {
|
||||
console.log("saving decimated mesh ["+vertices.length+"] time ["+(UTIL.time()-time)+"]");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,15 @@
|
|||
function onloaded (event) {
|
||||
if (event.target.status === 200 || event.target.status === 0) {
|
||||
stl.parse(event.target.response || event.target.responseText);
|
||||
if (callback) callback(stl.vertices);
|
||||
let cd = xhr.getResponseHeader('Content-Disposition');
|
||||
if (cd) {
|
||||
cd = cd.split(';').map(v => v.trim()).filter(v => {
|
||||
return v.indexOf('filename=') === 0;
|
||||
}).map(v => {
|
||||
return v.substring(10,v.length-1);
|
||||
});
|
||||
}
|
||||
if (callback) callback(stl.vertices, cd ? cd[0] : undefined);
|
||||
} else {
|
||||
if (callback) callback(null, event.target.statusText);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue