diff --git a/src/mesh/api.js b/src/mesh/api.js index 36f9be91..28a342a2 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -310,8 +310,9 @@ const pattern = { for (let i=1; i m.ungroup())).then(() => { return mesh.api.group.new(models) .centerModels() - .position(mid.x, mid.y, mid.z) - .setSelected(); + .position(mid.x, mid.y, mid.z);; }); }, @@ -972,7 +977,7 @@ const tool = { mesh: area.toFloat32() })).map( nm => nm.applyMatrix4(mcore.clone().multiply(m.mesh.matrixWorld)) ); if (nm.length) { - mesh.api.group.new(nm, undefined, "patch").setSelected(); + mesh.api.group.new(nm, undefined, "patch"); } }); promises.push(p); @@ -994,7 +999,7 @@ const tool = { file: m.file, mesh: vert.toFloat32() })).map( nm => nm.applyMatrix4(mcore.clone().multiply(m.mesh.matrixWorld)) ); - mesh.api.group.new(bodies, undefined, "isolate").setSelected(); + mesh.api.group.new(bodies, undefined, "isolate"); }); promises.push(p); } @@ -1050,7 +1055,7 @@ const tool = { log('repairing mesh(es)').pin(); tool.heal(models, { merge: true }).then(() => { log('repair commplete').unpin(); - api.selection.update(); + util.defer(selection.update); }); }, @@ -1058,7 +1063,7 @@ const tool = { models = fallback(models); tool.heal(models, { merge: false }).then(() => { log('cleaning complete').unpin(); - api.selection.update(); + util.defer(selection.update); }); }, @@ -1176,8 +1181,8 @@ const prefs = { space: { snap: 1, snapon: false, - center: true, - floor: true, + center: false, + floor: false, wire: false, grid: true, dark: false, diff --git a/src/mesh/build.js b/src/mesh/build.js index 7fbaa82b..351f8bbb 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -262,11 +262,11 @@ api.settings = function() { const set3 = h.div([ h.label({ class: "header", _: 'normal'}), h.label('length'), - h.input({ type: "text", size: 5, value: parseFloat(normals.length), + h.input({ type: "text", size: 6, value: parseFloat(normals.length), onchange: ev => call.set_normals_length(ev.target.value) }), h.label('color'), - h.input({ type: "text", size: 5, + h.input({ type: "text", size: 6, value: util.toHexRGB(dark ? normals.color_dark : normals.color_lite), onchange: ev => call.set_normals_color(util.fromHexRGB(ev.target.value)) }), @@ -297,7 +297,23 @@ api.settings = function() { }), ]); - modal.show('settings', h.div({ class: "settings" }, [ set1, set2, set3, set4, set5 ] )); + const set6 = h.div([ + h.label({ class: "header", _: 'duplicate'}), + h.label('select'), + h.input({ type: "checkbox", + onchange: ev => prefs.save( space.dup_sel = !space.dup_sel ), + [ space.dup_sel === true ? 'checked' : 'unchecked' ] : 1 + }), + h.label('shift'), + h.input({ type: "checkbox", + onchange: ev => prefs.save( space.dup_shift = !space.dup_shift ), + [ space.dup_shift === true ? 'checked' : 'unchecked' ] : 1 + }), + ]); + + modal.show('settings', h.div({ class: "settings" }, [ + set1, set2, set3, set4, set5, set6 + ] )); } // create html elements diff --git a/src/mesh/group.js b/src/mesh/group.js index 686f313c..33d50d40 100644 --- a/src/mesh/group.js +++ b/src/mesh/group.js @@ -154,13 +154,6 @@ mesh.group = class MeshGroup extends mesh.object { model.select(...arguments); } } - - // ok, this is confusing, but necessary for now :/ - // todo: obsolete? - setSelected() { - // super.select(); - return this; - } }; }); diff --git a/src/mesh/model.js b/src/mesh/model.js index bbcae39c..b02e2a73 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -205,7 +205,7 @@ mesh.model = class MeshModel extends mesh.object { return worker.model_duplicate({ matrix: this.matrix, id: this.id, - opt: { mirror: opt.mirror} + opt: { mirror: opt.mirror } }).then(data => { if (opt.append) data = [...data, ...opt.append].toFloat32(); if (opt.reload) return this.reload(data); @@ -213,9 +213,14 @@ mesh.model = class MeshModel extends mesh.object { let group = opt.group || mesh.api.group.new(); group.add(model); model.wireframe(this.wireframe()); - model.normals(this.normals()); - if (opt.select) group.setSelected(); - if (opt.mirror) group.move(0, 0, group.bounds.dim.z); + if (opt.select) { + api.selection.add(model); + } + if (opt.mirror) { + group.move(0, 0, group.bounds.dim.z); + } else if (opt.shift) { + group.move(group.bounds.dim.x, 0, 0); + } return model; }); } diff --git a/web/mesh/index.css b/web/mesh/index.css index 18162462..b1eacb2c 100644 --- a/web/mesh/index.css +++ b/web/mesh/index.css @@ -445,6 +445,7 @@ button:hover { font-family: monospace; text-align: center; background: #fff; + justify-self: end; } /** spinner animation **/