proof of concept stacking data boxes
This commit is contained in:
parent
91dd0bd4e7
commit
82f27f1dcf
3 changed files with 60 additions and 9 deletions
|
|
@ -136,6 +136,9 @@ function space_init(data) {
|
||||||
case 'KeyW':
|
case 'KeyW':
|
||||||
api.wireframe();
|
api.wireframe();
|
||||||
break;
|
break;
|
||||||
|
case 'KeyG':
|
||||||
|
api.grid();
|
||||||
|
break;
|
||||||
case 'KeyB':
|
case 'KeyB':
|
||||||
selection.boundsBox({toggle:true});
|
selection.boundsBox({toggle:true});
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,10 @@ function ui_build() {
|
||||||
let g_pos = util.average(s_grp.map(g => g.object.position));
|
let g_pos = util.average(s_grp.map(g => g.object.position));
|
||||||
let g_rot = util.average(s_grp.map(g => g.object.rotation));
|
let g_rot = util.average(s_grp.map(g => g.object.rotation));
|
||||||
let g_id = s_grp.map(g => g.id).join(' ');
|
let g_id = s_grp.map(g => g.id).join(' ');
|
||||||
let h_grp = [h.div([
|
let h_grp = [
|
||||||
h.button({ _: `group`, title: g_id }),
|
h.button({ id: "gs", class: "side" }, [ h.div('group')] ),
|
||||||
|
h.div({ id: "gd" }, [
|
||||||
|
h.button({ id: "gh", _: "group", title: g_id }),
|
||||||
grid(
|
grid(
|
||||||
util.extract(g_pos, map),
|
util.extract(g_pos, map),
|
||||||
util.extract(g_rot, map) )
|
util.extract(g_rot, map) )
|
||||||
|
|
@ -255,23 +257,29 @@ 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 = [h.div([
|
let h_mdl = [
|
||||||
h.button({ _: `model`, title: m_id }),
|
h.button({ id: "ms", class: "side" }, [ h.div('model')] ),
|
||||||
|
h.div({ id: "md" }, [
|
||||||
|
h.button({ id: "mh", _: "model", title: m_id }),
|
||||||
grid(
|
grid(
|
||||||
util.extract(m_pos, map),
|
util.extract(m_pos, map),
|
||||||
util.extract(m_rot, map) )
|
util.extract(m_rot, map) )
|
||||||
])];
|
])];
|
||||||
let bounds = util.bounds(s_mdl);
|
let bounds = util.bounds(s_mdl);
|
||||||
let h_bnd = [h.div([
|
let h_bnd = [
|
||||||
h.button({ _: `box`, title: m_id }),
|
h.button({ id: "bs", class: "side" }, [ h.div('box')] ),
|
||||||
|
h.div({ id: "bd" }, [
|
||||||
|
h.button({ id: "bh", _: 'box', title: m_id }),
|
||||||
grid(
|
grid(
|
||||||
util.extract(bounds.min, map),
|
util.extract(bounds.min, map),
|
||||||
util.extract(bounds.max, map),
|
util.extract(bounds.max, map),
|
||||||
[ "min", "max" ]
|
[ "min", "max" ]
|
||||||
)
|
)
|
||||||
])];
|
])];
|
||||||
let h_ara = [h.div([
|
let h_ara = [
|
||||||
h.button({ _: `span`, title: m_id }),
|
h.button({ id: "hs", class: "side" }, [ h.div('span')] ),
|
||||||
|
h.div({ id: "hd" }, [
|
||||||
|
h.button({ id: "hh", _: 'span', title: m_id }),
|
||||||
grid(
|
grid(
|
||||||
util.extract(bounds.center, map),
|
util.extract(bounds.center, map),
|
||||||
util.extract(bounds.size, map),
|
util.extract(bounds.size, map),
|
||||||
|
|
@ -291,7 +299,33 @@ function ui_build() {
|
||||||
h.label({ _: t_face }),
|
h.label({ _: t_face }),
|
||||||
])
|
])
|
||||||
])];
|
])];
|
||||||
h.bind(selectlist, [...h_grp, ...h_mdl, ...h_bnd, ...h_ara, ...h_msh]);
|
// bind elements to selectlist div
|
||||||
|
let bound = h.bind(selectlist, [
|
||||||
|
...h_grp,
|
||||||
|
...h_mdl,
|
||||||
|
...h_bnd,
|
||||||
|
...h_ara,
|
||||||
|
...h_msh
|
||||||
|
]);
|
||||||
|
// map buttons to show/hide selection info
|
||||||
|
function toggle(h, s, d) {
|
||||||
|
s.onclick = () => {
|
||||||
|
s.style.display = 'none';
|
||||||
|
d.style.display = 'flex';
|
||||||
|
};
|
||||||
|
h.onclick = () => {
|
||||||
|
d.style.display = 'none';
|
||||||
|
s.style.display = 'flex';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let { gh, gs, gd } = bound;
|
||||||
|
let { mh, ms, md } = bound;
|
||||||
|
let { bh, bs, bd } = bound;
|
||||||
|
let { hh, hs, hd } = bound;
|
||||||
|
toggle(gh, gs, gd);
|
||||||
|
toggle(mh, ms, md);
|
||||||
|
toggle(bh, bs, bd);
|
||||||
|
toggle(hh, hs, hd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// listen for api calls
|
// listen for api calls
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,20 @@ button:hover {
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#selectlist > .side {
|
||||||
|
position: relative;
|
||||||
|
width: 1.75em;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#selectlist > .side > div {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%) rotate(-90deg);
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
#selectlist > div {
|
#selectlist > div {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue