diff --git a/src/main/mesh.js b/src/main/mesh.js index f3d015f8..66a0ed11 100644 --- a/src/main/mesh.js +++ b/src/main/mesh.js @@ -171,7 +171,7 @@ function ui_build() { let g_rot = util.average(s_grp.map(g => g.object.rotation)); let g_id = s_grp.map(g => g.id).join(' '); let h_grp = [h.div([ - h.button({ _: `group`, title: g_id, xclass: [ "group" ], }), + h.button({ _: `group`, title: g_id }), grid( util.extract(g_pos, 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_id = s_mdl.map(m => m.id).join(' '); let h_mdl = [h.div([ - h.button({ _: `model`, title: m_id, xclass: [ "model" ], }), + h.button({ _: `model`, title: m_id }), grid( util.extract(m_pos, map), util.extract(m_rot, map) ) ])]; let bounds = util.bounds(s_mdl); let h_bnd = [h.div([ - h.button({ _: `box`, title: m_id, xclass: [ "box" ], }), + h.button({ _: `box`, title: m_id }), grid( util.extract(bounds.min, map), util.extract(bounds.max, map), @@ -195,14 +195,27 @@ function ui_build() { ) ])]; let h_ara = [h.div([ - h.button({ _: `area`, title: m_id, xclass: [ "area" ], }), + h.button({ _: `area`, title: m_id }), grid( util.extract(bounds.center, map), util.extract(bounds.size, map), [ "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 diff --git a/src/mesh/model.js b/src/mesh/model.js index db887076..f354419e 100644 --- a/src/mesh/model.js +++ b/src/mesh/model.js @@ -132,7 +132,7 @@ mesh.model = class MeshModel extends mesh.object { } get vertices() { - return this.attributes.vertices.count; + return this.attributes.position.count; } get faces() { diff --git a/web/mesh/index.css b/web/mesh/index.css index c2801a93..ea3cd708 100644 --- a/web/mesh/index.css +++ b/web/mesh/index.css @@ -240,10 +240,8 @@ button:hover { display: grid; gap: 2px 2px; 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; +}