extract png loader from kiri worker so it can be shared with mesh
This commit is contained in:
parent
7e954f5e56
commit
87df96d23f
6 changed files with 280 additions and 245 deletions
|
|
@ -301,8 +301,8 @@ const client = exports({
|
|||
if (reply.progress) {
|
||||
progress(reply.progress);
|
||||
}
|
||||
if (reply.done) {
|
||||
output(reply.done);
|
||||
if (reply.vertices) {
|
||||
output(reply.vertices);
|
||||
}
|
||||
}, [ data.png ]);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -483,13 +483,12 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
}
|
||||
|
||||
function loadImage(image, opt = {}) {
|
||||
const info = Object.assign({settings, png:image}, opt);
|
||||
const info = Object.assign({settings: settings.get(), png:image}, opt);
|
||||
kiri.client.image2mesh(info, progress => {
|
||||
api.show.progress(progress, "converting");
|
||||
}, output => {
|
||||
}, vertices => {
|
||||
api.show.progress(0);
|
||||
const { bigv, verts, index } = output;
|
||||
const widget = newWidget().loadVertices(bigv)
|
||||
const widget = newWidget().loadVertices(vertices);
|
||||
widget.meta.file = opt.file;
|
||||
platform.add(widget);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -728,6 +728,7 @@ function platformLoadFiles(files, group) {
|
|||
api.function.parse(e.target.result, 'gcode');
|
||||
load_dec();
|
||||
} else if (issvg) {
|
||||
group = group || [];
|
||||
let name = e.target.file.name;
|
||||
let svg = load.SVG.parse(e.target.result);
|
||||
let ind = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue