menu order, optimize bounds/wire show/hide

This commit is contained in:
Stewart Allen 2022-01-12 01:09:34 -05:00
commit 91995b5762
4 changed files with 13 additions and 2 deletions

View file

@ -26,6 +26,10 @@ let util = mesh.util;
let groups = [];
let selected = [];
let toggle = {
wire: false,
bound: false
};
let selection = {
// @returns {MeshObject[]} or all groups if not strict and no selection

View file

@ -222,10 +222,10 @@ function ui_build() {
]),
h.button({ _: 'export', onclick: api.file.export }),
h.div({ class: "vsep" }),
h.button({ _: 'bounds', onclick() { api.selection.boundsBox({toggle:true}) } }),
h.button({ _: 'visible', onclick() { api.selection.visible({ toggle: true }) } }),
h.button({ _: 'bounds', onclick() { api.selection.boundsBox({ toggle: true }) } }),
h.button({ _: 'gridlines', onclick() { api.grid() } }),
h.button({ _: 'wireframe', onclick() { api.wireframe() } }),
h.button({ _: 'visible', onclick() { api.selection.visible({ toggle: true }) } }),
h.div({ class: "vsep" }),
h.button({ _: 'duplicate', onclick: api.selection.duplicate }),
h.button({ _: 'merge', onclick: api.selection.merge }),

View file

@ -215,6 +215,9 @@ mesh.model = class MeshModel extends mesh.object {
return this.wireframe(this._wire ? false : true, opt);
}
let was = this._wire ? true : false;
if (was === bool) {
return was;
}
if (this._wire) {
this.mesh.remove(this._wire);
this._wire = undefined;

View file

@ -150,9 +150,13 @@ mesh.object = class MeshObject {
}
showBounds(bool) {
let was = this._showBounds;
if (bool && bool.toggle) {
bool = !this._showBounds;
}
if (was === bool) {
return;
}
this._showBounds = bool;
this.updateBoundsBox();
}