diff --git a/src/mesh/build.js b/src/mesh/build.js index 7f746ab9..1edf9f98 100644 --- a/src/mesh/build.js +++ b/src/mesh/build.js @@ -346,9 +346,9 @@ function ui_build() { h.div({ _: "" }), h.div({ _: "count", class: "top" }), h.div({ _: "vertex", class: "side" }), - h.label({ _: t_vert }), + h.label({ _: util.comma(t_vert) }), h.div({ _: "face", class: "side" }), - h.label({ _: t_face }), + h.label({ _: util.comma(t_face) }), ]) ])]; // bind elements to selectlist div diff --git a/src/mesh/util.js b/src/mesh/util.js index 2148c991..4516e5bc 100644 --- a/src/mesh/util.js +++ b/src/mesh/util.js @@ -27,6 +27,13 @@ let util = mesh.util = { return uid.join('-'); }, + // add comma separator to 1000s + comma(val) { + let str = val.toString().split("."); + str[0] = str[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); + return str.join("."); + }, + // merge repeated function calls like updates // that importantly take no arguments defer(fn, time = 50) { @@ -150,4 +157,4 @@ let util = mesh.util = { } }; -})(); \ No newline at end of file +})();