discrete widget state dirtying in belt / slice. fix op:trace unselect on modified

This commit is contained in:
Stewart Allen 2021-01-30 20:50:14 -05:00
commit e1ed1b93b6
3 changed files with 8 additions and 6 deletions

View file

@ -167,10 +167,14 @@ KIRI.work = {
id: widget.id,
settings: settings
}, function(reply) {
callback(reply);
if (reply.done || reply.error) {
delete slicing[widget.id];
// in belt mode, slicing modifies a widget and requires re-sync
if (settings.device.bedBelt) {
widget.modified = true;
}
}
callback(reply);
});
},

View file

@ -869,7 +869,6 @@
setOpacity(color.slicing_opacity);
STACKS.clear();
KIRI.client.clear();
KIRI.client.sync();
KIRI.client.rotate(settings);

View file

@ -534,7 +534,7 @@
KIRI.api.widgets.opacity(0.8);
KIRI.api.widgets.for(widget => {
if (ids.indexOf(widget.id) >= 0) {
unselectTraces(widget);
unselectTraces(widget, true);
widget.trace_stack = null;
}
if (widget.trace_stack) {
@ -544,7 +544,6 @@
}
let areas = (poppedRec.areas[widget.id] || []);
let stack = new KIRI.Stack(widget.mesh);
// console.log({match: areas, for: widget.id});
widget.trace_stack = stack;
widget.traces.forEach(poly => {
let match = areas.filter(arr => poly.matches(arr));
@ -1045,11 +1044,11 @@
}
}
function unselectTraces(widget) {
function unselectTraces(widget, skip) {
if (widget.trace_stack) {
widget.trace_stack.meshes.forEach(mesh => {
if (mesh.selected) {
func.traceToggle(mesh);
func.traceToggle(mesh, skip);
}
});
}