persist layer visibility selections
This commit is contained in:
parent
5b4d89171d
commit
7a6cfd266c
5 changed files with 50 additions and 1 deletions
|
|
@ -633,6 +633,7 @@
|
|||
view: null,
|
||||
dark: false,
|
||||
decals: true,
|
||||
danger: false,
|
||||
zoomSpeed: 1.0,
|
||||
lineType: "path",
|
||||
autoSave: true,
|
||||
|
|
@ -651,6 +652,8 @@
|
|||
detail: "good",
|
||||
animesh: "200"
|
||||
},
|
||||
// label state preferences
|
||||
labels: {},
|
||||
// for passing temporary slice hints (topo currently)
|
||||
synth: {},
|
||||
// widget extra info for slicing (extruder mapping)
|
||||
|
|
|
|||
|
|
@ -1991,6 +1991,19 @@
|
|||
UI.sliderHold.style.marginRight = `${hival}px`;
|
||||
});
|
||||
|
||||
// store layer preferences
|
||||
API.event.on('stack.show', label => {
|
||||
let mode = API.mode.get();
|
||||
let view = API.view.get();
|
||||
API.conf.get().labels[`${mode}-${view}-${label}`] = true;
|
||||
});
|
||||
|
||||
API.event.on('stack.hide', label => {
|
||||
let mode = API.mode.get();
|
||||
let view = API.view.get();
|
||||
API.conf.get().labels[`${mode}-${view}-${label}`] = false;
|
||||
});
|
||||
|
||||
// bind language choices
|
||||
$('lset-en').onclick = function() {
|
||||
SDB.setItem('kiri-lang', 'en-us');
|
||||
|
|
|
|||
|
|
@ -935,6 +935,12 @@
|
|||
});
|
||||
updateSliderMax(true);
|
||||
setVisibleLayer(-1, 0);
|
||||
if (scale === 1) {
|
||||
for (let label of STACKS.getLabels()) {
|
||||
let check = `${mode}-${viewMode}-${label}`;
|
||||
STACKS.setVisible(label, settings.labels[check] !== false);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (scale === 1) {
|
||||
API.show.progress(0);
|
||||
|
|
@ -1071,6 +1077,12 @@
|
|||
setVisibleLayer(-1, 0);
|
||||
updateSpeeds(maxSpeed);
|
||||
|
||||
// maatch label checkboxes to preference
|
||||
for (let label of STACKS.getLabels()) {
|
||||
let check = `${settings.mode}-${viewMode}-${label}`;
|
||||
STACKS.setVisible(label, settings.labels[check] !== false);
|
||||
}
|
||||
|
||||
// mark preview complete for export
|
||||
complete.preview = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,20 @@
|
|||
return stacks[name];
|
||||
}
|
||||
|
||||
function getLabels() {
|
||||
return Object.keys(DYN);
|
||||
}
|
||||
|
||||
function setVisible(label, bool) {
|
||||
let ctrl = DYN[label];
|
||||
if (ctrl) {
|
||||
ctrl.toggle.checked = bool;
|
||||
ctrl.group.forEach(mat => {
|
||||
mat.visible = bool;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function create(name, view) {
|
||||
if (stacks[name]) {
|
||||
return stacks[name];
|
||||
|
|
@ -70,6 +84,11 @@
|
|||
ctrl.group.forEach(mat => {
|
||||
mat.visible = ctrl.toggle.checked;
|
||||
});
|
||||
if (ctrl.toggle.checked) {
|
||||
KIRI.api.event.emit("stack.show", label);
|
||||
} else {
|
||||
KIRI.api.event.emit("stack.hide", label)
|
||||
}
|
||||
})
|
||||
};
|
||||
let color = lmap[label].color.check;
|
||||
|
|
@ -128,6 +147,8 @@
|
|||
getStack,
|
||||
getRange,
|
||||
setRange,
|
||||
getLabels,
|
||||
setVisible,
|
||||
setFreeMem
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
retSpeed = process.outputRetractSpeed * 60,
|
||||
retDwell = process.outputRetractDwell || 0,
|
||||
timeDwell = retDwell / 1000,
|
||||
arcDist = isBelt || isDanger ? 0 : (process.arcTolerance || 0),
|
||||
arcDist = isBelt || !isDanger ? 0 : (process.arcTolerance || 0),
|
||||
originCenter = process.outputOriginCenter,
|
||||
offset = originCenter ? null : {
|
||||
x: device.bedWidth/2,
|
||||
|
|
|
|||
Loading…
Reference in a new issue