From 38f5399573f3cc6419cad80be3190ccffce74513 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 15 May 2022 14:48:22 -0400 Subject: [PATCH] remove zlist() in mesh, test structuredClone for object.clone --- notes.md | 3 +++ src/add/array.js | 3 ++- src/mesh/model.js | 9 --------- src/mesh/work.js | 13 ------------- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/notes.md b/notes.md index 14ab79f3..2673b0a9 100644 --- a/notes.md +++ b/notes.md @@ -2,6 +2,9 @@ ## `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 * `B` origin (and bed size) bug (Onshape?) when switching device modes diff --git a/src/add/array.js b/src/add/array.js index fa7796f1..a2449742 100644 --- a/src/add/array.js +++ b/src/add/array.js @@ -218,7 +218,8 @@ String.prototype.reverse = function() { }; 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) { diff --git a/src/mesh/model.js b/src/mesh/model.js index fcb0369a..8a9c834f 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -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 // so it can be re-assigned to another group ungroup() { diff --git a/src/mesh/work.js b/src/mesh/work.js index 0fdc44a7..ff8399fe 100644 --- a/src/mesh/work.js +++ b/src/mesh/work.js @@ -172,19 +172,6 @@ let model = { 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 parseFloat(v)); - }, - // split a model along an axis at a given point // return two arrays of vertices for each resulting object split(data) {