rework and improve tool bar pop menus

This commit is contained in:
Stewart Allen 2024-06-05 17:36:35 -07:00
commit 3a97903017
9 changed files with 179 additions and 129 deletions

View file

@ -24,12 +24,18 @@ function for_groups(fn) {
function for_widgets(fn, noauto) {
let m = selectedMeshes;
let w = api.widgets.all();
if (m.length === 0 && w.length === 1) {
m = noauto ? [] : [ w[0].mesh ];
if (m.length === 0 && w.length) {
m = noauto ? [] : w.map(w => w.mesh);
}
m.slice().forEach(mesh => { fn(mesh.widget) });
}
function for_status(fn) {
api.widgets.all().forEach(w => {
fn(w, selectedMeshes.contains(w.mesh));
});
}
function for_meshes(fn) {
selectedMeshes.slice().forEach(mesh => { fn(mesh) });
}
@ -276,6 +282,7 @@ const selection = api.selection = {
duplicate,
for_groups,
for_meshes,
for_status,
for_widgets,
update_bounds,
update_info,