highlight and update extruder selection for widget
This commit is contained in:
parent
9a6a861fc4
commit
af66eff5cd
2 changed files with 15 additions and 0 deletions
|
|
@ -549,9 +549,11 @@ var gs_kiri_init = exports;
|
||||||
for (let i=dev.extruders.length-1; i>=0; i--) {
|
for (let i=dev.extruders.length-1; i>=0; i--) {
|
||||||
let b = DOC.createElement('button');
|
let b = DOC.createElement('button');
|
||||||
b.appendChild(DOC.createTextNode(i));
|
b.appendChild(DOC.createTextNode(i));
|
||||||
|
b.setAttribute('id', `sel-ext-${i}`);
|
||||||
b.onclick = function() {
|
b.onclick = function() {
|
||||||
API.selection.for_widgets(w => {
|
API.selection.for_widgets(w => {
|
||||||
current.widget[w.id] = {extruder: i};
|
current.widget[w.id] = {extruder: i};
|
||||||
|
API.platform.update_selected();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
selext.appendChild(b);
|
selext.appendChild(b);
|
||||||
|
|
|
||||||
13
js/kiri.js
13
js/kiri.js
|
|
@ -106,6 +106,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
update_stock: platformUpdateStock,
|
update_stock: platformUpdateStock,
|
||||||
update_size: platformUpdateSize,
|
update_size: platformUpdateSize,
|
||||||
update_top_z: platformUpdateTopZ,
|
update_top_z: platformUpdateTopZ,
|
||||||
|
update_selected: platformUpdateSelected,
|
||||||
load_files: platformLoadFiles,
|
load_files: platformLoadFiles,
|
||||||
group: platformGroup,
|
group: platformGroup,
|
||||||
group_done: platformGroupDone
|
group_done: platformGroupDone
|
||||||
|
|
@ -1001,6 +1002,18 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
|
|
||||||
function platformUpdateSelected() {
|
function platformUpdateSelected() {
|
||||||
UI.selection.style.display = platform.selected_count() ? 'inline' : 'none';
|
UI.selection.style.display = platform.selected_count() ? 'inline' : 'none';
|
||||||
|
let extruders = settings.device.extruders;
|
||||||
|
if (extruders) {
|
||||||
|
for (let i=0; i<extruders.length; i++) {
|
||||||
|
let b = $(`sel-ext-${i}`);
|
||||||
|
if (b) b.classList.remove('buton');
|
||||||
|
}
|
||||||
|
forSelectedWidgets(w => {
|
||||||
|
let ext = settings.widget[w.id].extruder || 0;
|
||||||
|
let b = $(`sel-ext-${ext}`);
|
||||||
|
if (b) b.classList.add('buton');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function platformDeselect(widget) {
|
function platformDeselect(widget) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue