remove unused classes. add total vertex, face counts

This commit is contained in:
Stewart Allen 2022-01-05 22:09:49 -05:00
commit 889ffff25f
3 changed files with 22 additions and 11 deletions

View file

@ -171,7 +171,7 @@ function ui_build() {
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.div([
h.button({ _: `group`, title: g_id, xclass: [ "group" ], }), h.button({ _: `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) )
@ -180,14 +180,14 @@ function ui_build() {
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.div([
h.button({ _: `model`, title: m_id, xclass: [ "model" ], }), h.button({ _: `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.div([
h.button({ _: `box`, title: m_id, xclass: [ "box" ], }), h.button({ _: `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),
@ -195,14 +195,27 @@ function ui_build() {
) )
])]; ])];
let h_ara = [h.div([ let h_ara = [h.div([
h.button({ _: `area`, title: m_id, xclass: [ "area" ], }), h.button({ _: `area`, 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),
[ "center", "size" ] [ "center", "size" ]
) )
])]; ])];
h.bind(selectlist, [...h_grp, ...h_mdl, ...h_bnd, ...h_ara]); let t_vert = s_mdl.map(m => m.vertices).reduce((a,v) => a+v);
let t_face = s_mdl.map(m => m.faces).reduce((a,v) => a+v);
let h_msh = [h.div([
h.button({ _: `mesh` }),
h.div({ class: ["grid","grid2"]}, [
h.div({ _: "" }),
h.div({ _: "count", class: "top" }),
h.div({ _: "vertex", class: "side" }),
h.label({ _: t_vert }),
h.div({ _: "face", class: "side" }),
h.label({ _: t_face }),
])
])];
h.bind(selectlist, [...h_grp, ...h_mdl, ...h_bnd, ...h_ara, ...h_msh]);
} }
// listen for api calls // listen for api calls

View file

@ -132,7 +132,7 @@ mesh.model = class MeshModel extends mesh.object {
} }
get vertices() { get vertices() {
return this.attributes.vertices.count; return this.attributes.position.count;
} }
get faces() { get faces() {

View file

@ -240,10 +240,8 @@ button:hover {
display: grid; display: grid;
gap: 2px 2px; gap: 2px 2px;
grid: min-content 1fr 1fr / min-content 1fr 1fr 1fr; grid: min-content 1fr 1fr / min-content 1fr 1fr 1fr;
grid-template-areas:
". head head head"
"label data data data"
"label data data data";
} }
#selectlist #selectlist .grid2 {
grid: min-content 1fr / min-content 1fr;
}