worker logging to ui. fix pinning
This commit is contained in:
parent
63a71d0739
commit
bc3f0e5d2b
2 changed files with 12 additions and 7 deletions
|
|
@ -86,7 +86,7 @@ let log = mesh.api.log = {
|
|||
text: `${dbug.since()} | ${msg}`,
|
||||
time: now
|
||||
});
|
||||
while (data.length && (data.length > lines || now - data[0].time > age)) {
|
||||
while (!log.pinned && data.length && (data.length > lines || now - data[0].time > age)) {
|
||||
data.shift();
|
||||
}
|
||||
return render();
|
||||
|
|
@ -98,17 +98,20 @@ let log = mesh.api.log = {
|
|||
},
|
||||
|
||||
pin() {
|
||||
return log.show(1 << 30);
|
||||
log.pinned = true;
|
||||
return log.show();
|
||||
},
|
||||
|
||||
unpin() {
|
||||
log.pinned = false;
|
||||
return log.show();
|
||||
},
|
||||
|
||||
// show log window for `time` milliseconds or default
|
||||
show(time) {
|
||||
clearTimeout(log.timer);
|
||||
log.timer = setTimeout(log.hide, time || log.wait);
|
||||
log.timer = log.pinned ? null : setTimeout(log.hide, time || log.wait);
|
||||
$('logger').style.display = 'flex';
|
||||
return log;
|
||||
},
|
||||
|
||||
|
|
@ -117,7 +120,6 @@ let log = mesh.api.log = {
|
|||
let area = $('logtext');
|
||||
h.bind(area, log.data.map(rec => h.div({ _: rec.text })));
|
||||
area.scrollTop = area.scrollHeight;
|
||||
$('logger').style.display = 'flex';
|
||||
return log.show();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ let core_matrix = new THREE.Matrix4().makeRotationX(Math.PI / 2);
|
|||
let { client, worker } = moto;
|
||||
let cache = {};
|
||||
|
||||
function log(msg) {
|
||||
return worker.publish("mesh.log", msg);
|
||||
}
|
||||
|
||||
function cacheUpdate(id, data) {
|
||||
Object.assign(cache[id], data);
|
||||
}
|
||||
|
|
@ -47,16 +51,15 @@ let model = {
|
|||
},
|
||||
|
||||
heal(id) {
|
||||
dbug.log({healing: id});
|
||||
log(`${id} | indexing...`);
|
||||
let geo = cache[id].geo;
|
||||
let tool = new mesh.tool({
|
||||
vertices: geo.attributes.position.array,
|
||||
faces: geo.index ? geo.index.array : undefined,
|
||||
debug: false
|
||||
});
|
||||
dbug.log('...imported data');
|
||||
log(`${id} | healing...`);
|
||||
tool.heal();
|
||||
dbug.log('...healed');
|
||||
dbug.log(tool);
|
||||
return true || tool.newFaces ? {
|
||||
vertices: tool.unrolled().toFloat32(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue