add auto-timed spinner on pinned logs. add alt options for calculating face normal deviation. center spinner
This commit is contained in:
parent
a74261b341
commit
d0ab98f6ac
4 changed files with 31 additions and 10 deletions
|
|
@ -114,6 +114,7 @@ const modal = api.modal = {
|
|||
}
|
||||
};
|
||||
|
||||
let pinner;
|
||||
// transient logging window bottom/left
|
||||
const log = api.log = {
|
||||
age: 10000, // age out lines more than 10 seconds old
|
||||
|
|
@ -149,16 +150,20 @@ const log = api.log = {
|
|||
return log.pinned ? log.unpin() && log.hide() : log.pin(opt);
|
||||
},
|
||||
|
||||
pin(opt = { spinner: true }) {
|
||||
pin(opt = { spinner: 100 }) {
|
||||
log.pinned = true;
|
||||
if (opt.spinner) {
|
||||
$('pinner').style.display = 'inline-block';
|
||||
if (opt.spinner > 0) {
|
||||
clearTimeout(pinner);
|
||||
pinner = setTimeout(() => {
|
||||
$('pinner').style.display = 'inline-block';
|
||||
}, opt.spinner);
|
||||
}
|
||||
return log.show();
|
||||
},
|
||||
|
||||
unpin() {
|
||||
log.pinned = false;
|
||||
clearTimeout(pinner);
|
||||
$('pinner').style.display = 'none';
|
||||
return log.show();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
let timer = setTimeout(() => {
|
||||
timer = undefined;
|
||||
mesh.api.log.emit("matching surface").pin();
|
||||
}, 500);
|
||||
}, 150);
|
||||
worker.model_select({
|
||||
id: this.id, x, y:-z, z:y, a, b, c, matrix: this.matrix, radians
|
||||
}).then(data => {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ gapp.register("mesh.tool", [], (root, exports) => {
|
|||
|
||||
const { mesh } = root;
|
||||
const { geom } = mesh;
|
||||
const { Vector3 } = THREE;
|
||||
|
||||
/**
|
||||
* tool for identiying defects and healing them
|
||||
|
|
@ -163,14 +164,27 @@ mesh.tool = class MeshTool {
|
|||
for (let face of faces) {
|
||||
found[face] = 1;
|
||||
}
|
||||
// const _v1 = new Vector3();
|
||||
// const _v2 = new Vector3();
|
||||
while (check.length) {
|
||||
const face = check.shift();
|
||||
const norm = this.normals[face];
|
||||
const fadj = this.getAdjacentFaces(face).filter(f => !found[f]);
|
||||
for (let f of fadj) {
|
||||
const fn = this.normals[f]
|
||||
.map((v,i) => Math.abs(norm[i] - v))
|
||||
.reduce((a,v) => a + v);
|
||||
// #1 most accurate
|
||||
// const nf = this.normals[f];
|
||||
// _v1.set(nf[0], nf[1], nf[2]);
|
||||
// _v2.set(norm[0], norm[1], norm[2]);
|
||||
// const fn = _v1.angleTo(_v2);
|
||||
// #2 slightly less so
|
||||
// const pf = Math.PI / 4;
|
||||
// const fn = Math.sin(pf * Math.sqrt(this.normals[f]
|
||||
// .map((v,i) => Math.pow(norm[i] - v, 2))
|
||||
// .reduce((a,v) => a + v)));
|
||||
// #3 fastest, still good
|
||||
const fn = Math.sqrt(this.normals[f]
|
||||
.map((v,i) => Math.pow(norm[i] - v, 2))
|
||||
.reduce((a,v) => a + v));
|
||||
if (fn <= radians) {
|
||||
faces.push(f);
|
||||
check.push(f)
|
||||
|
|
|
|||
|
|
@ -592,8 +592,10 @@ button.selected:hover {
|
|||
z-index: 5000;
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
bottom: 5px;
|
||||
left: 50%;
|
||||
bottom: 50%;
|
||||
translateX: -50%;
|
||||
translateX: -50%;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border: 6px solid rgba(0,0,0,0.1);
|
||||
|
|
@ -603,5 +605,5 @@ button.selected:hover {
|
|||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { -webkit-transform: rotate(360deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue