diff --git a/src/main/mesh.js b/src/main/mesh.js index ddcdc54f..f5e61bd4 100644 --- a/src/main/mesh.js +++ b/src/main/mesh.js @@ -447,9 +447,10 @@ function space_init(data) { }); space.mouse.onDrag((delta, offset, up = false) => { + const { mode, modes } = api; if (delta && delta.event.shiftKey) { selection.move(delta.x, delta.y, 0); - } else { + } else if (mode.is([ modes.object, modes.tool ])) { return api.objects().length > 0; } }); diff --git a/src/mesh/api.js b/src/mesh/api.js index ad8d8be7..4730fc3a 100644 --- a/src/mesh/api.js +++ b/src/mesh/api.js @@ -374,7 +374,7 @@ const tool = { union(models) { models = fallback(models); - api.log.emit(`union ${models.length} model(s)`).pin(); + api.log.emit(`union ${models.length} models`).pin(); worker.model_union(models.map(m => { return { id: m.id, matrix: m.matrix } })) @@ -390,7 +390,7 @@ const tool = { intersect(models) { models = fallback(models); - api.log.emit(`intersect ${models.length} model(s)`).pin(); + api.log.emit(`intersect ${models.length} models`).pin(); worker.model_intersect(models.map(m => { return { id: m.id, matrix: m.matrix } })) @@ -406,7 +406,7 @@ const tool = { subtract(models) { models = fallback(models); - api.log.emit(`subtract ${models.length} model(s)`).pin(); + api.log.emit(`subtract ${models.length} models`).pin(); worker.model_subtract(models.map(m => { return { id: m.id, matrix: m.matrix, tool: m.tool() } })) diff --git a/src/mesh/build.js b/src/mesh/build.js index 05b987c5..121f7045 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -439,13 +439,29 @@ function ui_build() { class: [ "group", selHas(g) ? 'selected' : undefined ], onclick(e) { selection.toggle(g) } }), - h.div({ class: "vsep" }), h.div({ class: "models"}, // map models to buttons g.models.map(m => [ h.button({ _: m.file || m.id, class: [ selHas(m) ? 'selected' : undefined ], - onclick(e) { selection.toggle(m) } + onclick(e) { + if (e.shiftKey) { + console.log({m, selection}); + tool.rename([ m ]); + } else { + selection.toggle(m); + } + }, + onmouseover(e) { + if (!m.wireframe().enabled) { + m.opacity({temp: 0.5}); + } + }, + onmouseleave(e) { + if (!m.wireframe().enabled) { + m.opacity({restore: true}); + } + } }), h.button({ class: [ 'square' ], @@ -534,17 +550,8 @@ function ui_build() { let m_pos = util.average(s_mdl.map(m => m.object.position)); let m_rot = util.average(s_mdl.map(m => m.object.rotation)); let m_id = s_mdl.map(m => m.id).join(' '); - // let h_mdl = sblock('model', m_id, grid( - // util.extract(m_pos, map), - // util.extract(m_rot, map) - // )); let bounds = util.bounds(s_mdl); - // let h_bnd = sblock('bounds', m_id, grid( - // util.extract(bounds.min, map), - // util.extract(bounds.max, map), - // [ "min", "max" ] - // )); let h_ara = sblock('span', m_id, grid( util.extract(bounds.center, map), util.extract(bounds.size, map), @@ -584,8 +591,6 @@ function ui_build() { // bind elements to selectlist div let bound = h.bind(selectlist, [ ...h_grp, - // ...h_mdl, - // ...h_bnd, ...h_ara, ...h_msh, ...h_ops