toggle transparency on model button hover for easier identification
This commit is contained in:
parent
5ba57ef249
commit
9c46e8183a
3 changed files with 23 additions and 17 deletions
|
|
@ -447,9 +447,10 @@ function space_init(data) {
|
||||||
});
|
});
|
||||||
|
|
||||||
space.mouse.onDrag((delta, offset, up = false) => {
|
space.mouse.onDrag((delta, offset, up = false) => {
|
||||||
|
const { mode, modes } = api;
|
||||||
if (delta && delta.event.shiftKey) {
|
if (delta && delta.event.shiftKey) {
|
||||||
selection.move(delta.x, delta.y, 0);
|
selection.move(delta.x, delta.y, 0);
|
||||||
} else {
|
} else if (mode.is([ modes.object, modes.tool ])) {
|
||||||
return api.objects().length > 0;
|
return api.objects().length > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ const tool = {
|
||||||
|
|
||||||
union(models) {
|
union(models) {
|
||||||
models = fallback(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 => {
|
worker.model_union(models.map(m => {
|
||||||
return { id: m.id, matrix: m.matrix }
|
return { id: m.id, matrix: m.matrix }
|
||||||
}))
|
}))
|
||||||
|
|
@ -390,7 +390,7 @@ const tool = {
|
||||||
|
|
||||||
intersect(models) {
|
intersect(models) {
|
||||||
models = fallback(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 => {
|
worker.model_intersect(models.map(m => {
|
||||||
return { id: m.id, matrix: m.matrix }
|
return { id: m.id, matrix: m.matrix }
|
||||||
}))
|
}))
|
||||||
|
|
@ -406,7 +406,7 @@ const tool = {
|
||||||
|
|
||||||
subtract(models) {
|
subtract(models) {
|
||||||
models = fallback(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 => {
|
worker.model_subtract(models.map(m => {
|
||||||
return { id: m.id, matrix: m.matrix, tool: m.tool() }
|
return { id: m.id, matrix: m.matrix, tool: m.tool() }
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -439,13 +439,29 @@ function ui_build() {
|
||||||
class: [ "group", selHas(g) ? 'selected' : undefined ],
|
class: [ "group", selHas(g) ? 'selected' : undefined ],
|
||||||
onclick(e) { selection.toggle(g) }
|
onclick(e) { selection.toggle(g) }
|
||||||
}),
|
}),
|
||||||
h.div({ class: "vsep" }),
|
|
||||||
h.div({ class: "models"},
|
h.div({ class: "models"},
|
||||||
// map models to buttons
|
// map models to buttons
|
||||||
g.models.map(m => [
|
g.models.map(m => [
|
||||||
h.button({ _: m.file || m.id,
|
h.button({ _: m.file || m.id,
|
||||||
class: [ selHas(m) ? 'selected' : undefined ],
|
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({
|
h.button({
|
||||||
class: [ 'square' ],
|
class: [ 'square' ],
|
||||||
|
|
@ -534,17 +550,8 @@ function ui_build() {
|
||||||
let m_pos = util.average(s_mdl.map(m => m.object.position));
|
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_rot = util.average(s_mdl.map(m => m.object.rotation));
|
||||||
let m_id = s_mdl.map(m => m.id).join(' ');
|
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 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(
|
let h_ara = sblock('span', m_id, grid(
|
||||||
util.extract(bounds.center, map),
|
util.extract(bounds.center, map),
|
||||||
util.extract(bounds.size, map),
|
util.extract(bounds.size, map),
|
||||||
|
|
@ -584,8 +591,6 @@ function ui_build() {
|
||||||
// bind elements to selectlist div
|
// bind elements to selectlist div
|
||||||
let bound = h.bind(selectlist, [
|
let bound = h.bind(selectlist, [
|
||||||
...h_grp,
|
...h_grp,
|
||||||
// ...h_mdl,
|
|
||||||
// ...h_bnd,
|
|
||||||
...h_ara,
|
...h_ara,
|
||||||
...h_msh,
|
...h_msh,
|
||||||
...h_ops
|
...h_ops
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue