wiring up more ui components

This commit is contained in:
Stewart Allen 2022-01-06 20:22:50 -05:00
commit 76d197ab31
5 changed files with 44 additions and 21 deletions

View file

@ -211,6 +211,38 @@ let model = {
}
};
let file = {
import() {
// binding created in mesh.build
$('import').click();
},
export() {
console.log('...export todo');
},
};
let tool = {
analyze() {
console.log('...analyze todo');
},
repair() {
for (let m of selection.models()) {
moto.client.fn.model_heal(m.id)
.then(data => {
if (data) {
m.reload(
data.vertices,
data.indices,
data.normals
);
}
});
}
}
};
// api is augmented in mesh.build
let api = mesh.api = {
clear() {
@ -246,10 +278,9 @@ let api = mesh.api = {
model,
import() {
// binding created in mesh.build
$('import').click();
},
file,
tool,
objects() {
// return model objects suitable for finding ray intersections

View file

@ -83,16 +83,16 @@ function ui_build() {
h.bind(actions, [
h.div([
// create and bind file loading elements
h.button({ _: 'import', onclick: api.import }, [
h.button({ _: 'import', onclick: api.file.import }, [
h.input({
id: "import", type: "file", class: ["hide"], multiple: true,
onchange(evt) { broker.send.load_files(evt.target.files) }
})
]),
h.button({ _: 'export' }),
h.button({ _: 'export', onclick: api.file.export, disabled: true }),
h.div({ class: "vsep" }),
h.button({ _: 'analyze' }),
h.button({ _: 'repair' }),
h.button({ _: 'analyze', disabled: true }),
h.button({ _: 'repair', onclick: api.tool.repair }),
h.div({ class: "vsep" }),
h.button({ _: 'wireframe', onclick() { api.wireframe() } }),
]),
@ -185,7 +185,7 @@ function ui_build() {
)
])];
let h_ara = [h.div([
h.button({ _: `area`, title: m_id }),
h.button({ _: `span`, title: m_id }),
grid(
util.extract(bounds.center, map),
util.extract(bounds.size, map),