remove zlist() in mesh, test structuredClone for object.clone
This commit is contained in:
parent
b34cad3523
commit
38f5399573
4 changed files with 5 additions and 23 deletions
3
notes.md
3
notes.md
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
|
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
|
||||||
|
|
||||||
|
* `F` experiment with structuredClone(), SharedArrayBuffer, createImageBitmap()
|
||||||
|
* `F` test #private fields, array.at() for negative indices
|
||||||
|
|
||||||
# Kiri:Moto
|
# Kiri:Moto
|
||||||
|
|
||||||
* `B` origin (and bed size) bug (Onshape?) when switching device modes
|
* `B` origin (and bed size) bug (Onshape?) when switching device modes
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,8 @@ String.prototype.reverse = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.clone = function(o) {
|
Object.clone = function(o) {
|
||||||
return o ? JSON.parse(JSON.stringify(o)) : o;
|
return structuredClone(o);
|
||||||
|
// return o ? JSON.parse(JSON.stringify(o)) : o;
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.toArray = function(o) {
|
Object.toArray = function(o) {
|
||||||
|
|
|
||||||
|
|
@ -449,15 +449,6 @@ mesh.model = class MeshModel extends mesh.object {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
zlist(round = 2) {
|
|
||||||
return new Promise((resolve,reject) => {
|
|
||||||
let { id, matrix } = this;
|
|
||||||
worker.model_zlist({id, matrix, round}).then(data => {
|
|
||||||
resolve(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// release from a group but remain in memory and storage
|
// release from a group but remain in memory and storage
|
||||||
// so it can be re-assigned to another group
|
// so it can be re-assigned to another group
|
||||||
ungroup() {
|
ungroup() {
|
||||||
|
|
|
||||||
|
|
@ -172,19 +172,6 @@ let model = {
|
||||||
return subs.toFloat32();
|
return subs.toFloat32();
|
||||||
},
|
},
|
||||||
|
|
||||||
// used to generate a list for split snapping
|
|
||||||
zlist(data) {
|
|
||||||
let { id, matrix, round } = data;
|
|
||||||
let zlist = {};
|
|
||||||
let pos = translate_encode(id, matrix);
|
|
||||||
for (let i=0, l=pos.length; i<l; ) {
|
|
||||||
let v1 = new Vector3(pos[i++], pos[i++], pos[i++]);
|
|
||||||
let z = v1.z.round(round || 2);
|
|
||||||
zlist[z] = '';
|
|
||||||
}
|
|
||||||
return Object.keys(zlist).map(v => parseFloat(v));
|
|
||||||
},
|
|
||||||
|
|
||||||
// split a model along an axis at a given point
|
// split a model along an axis at a given point
|
||||||
// return two arrays of vertices for each resulting object
|
// return two arrays of vertices for each resulting object
|
||||||
split(data) {
|
split(data) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue