checkpoint

This commit is contained in:
Stewart Allen 2024-05-29 17:55:34 -04:00
commit 38f556736a
5 changed files with 67 additions and 113 deletions

View file

@ -1819,11 +1819,11 @@ gapp.register("kiri.init", [], (root, exports) => {
_____: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven, separator }), _____: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven, separator }),
sliceHeight: newInput(LANG.sl_lahi_s, { title:LANG.sl_lahi_l, convert:toFloat }), sliceHeight: newInput(LANG.sl_lahi_s, { title:LANG.sl_lahi_l, convert:toFloat }),
sliceMinHeight: newInput(LANG.ad_minl_s, { title:LANG.ad_minl_l, convert:toFloat, bound:bound(0,3.0), show: () => ui.sliceAdaptive.checked}), sliceMinHeight: newInput(LANG.ad_minl_s, { title:LANG.ad_minl_l, convert:toFloat, bound:bound(0,3.0), show:() => ui.sliceAdaptive.checked, trace2:true }),
sliceTopLayers: newInput(LANG.sl_ltop_s, { title:LANG.sl_ltop_l, convert:toInt }), sliceTopLayers: newInput(LANG.sl_ltop_s, { title:LANG.sl_ltop_l, convert:toInt }),
sliceBottomLayers: newInput(LANG.sl_lbot_s, { title:LANG.sl_lbot_l, convert:toInt }), sliceBottomLayers: newInput(LANG.sl_lbot_s, { title:LANG.sl_lbot_l, convert:toInt }),
separator: newBlank({ class:"set-sep", driven }), separator: newBlank({ class:"set-sep", driven }),
sliceAdaptive: newBoolean(LANG.ad_adap_s, onBooleanClick, {title: LANG.ad_adap_l, trigger: true}), sliceAdaptive: newBoolean(LANG.ad_adap_s, onBooleanClick, { title: LANG.ad_adap_l }),
_____: newGroup(LANG.sw_menu, $('fdm-walls'), { modes:FDM, driven, separator }), _____: newGroup(LANG.sw_menu, $('fdm-walls'), { modes:FDM, driven, separator }),
sliceShells: newInput(LANG.sl_shel_s, { title:LANG.sl_shel_l, convert:toFloat }), sliceShells: newInput(LANG.sl_shel_s, { title:LANG.sl_shel_l, convert:toFloat }),
sliceLineWidth: newInput(LANG.sl_line_s, { title:LANG.sl_line_l, convert:toFloat, bound:bound(0,5) }), sliceLineWidth: newInput(LANG.sl_line_s, { title:LANG.sl_line_l, convert:toFloat, bound:bound(0,5) }),
@ -1858,7 +1858,7 @@ gapp.register("kiri.init", [], (root, exports) => {
sliceSupportExtra: newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, convert:toFloat, bound:bound(0.0,10.0)}), sliceSupportExtra: newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, convert:toFloat, bound:bound(0.0,10.0)}),
sliceSupportGrow: newInput(LANG.sp_grow_s, {title:LANG.sp_grow_l, convert:toFloat, bound:bound(0.0,10.0)}), sliceSupportGrow: newInput(LANG.sp_grow_s, {title:LANG.sp_grow_l, convert:toFloat, bound:bound(0.0,10.0)}),
sliceSupportAngle: newInput(LANG.sp_angl_s, {title:LANG.sp_angl_l, convert:toFloat, bound:bound(0.0,90.0)}), sliceSupportAngle: newInput(LANG.sp_angl_s, {title:LANG.sp_angl_l, convert:toFloat, bound:bound(0.0,90.0)}),
sliceSupportSpan: newInput(LANG.sp_span_s, {title:LANG.sp_span_l, convert:toFloat, bound:bound(0.0,200.0), show:() => ui.sliceSupportEnable.checked}), sliceSupportSpan: newInput(LANG.sp_span_s, {title:LANG.sp_span_l, convert:toFloat, bound:bound(0.0,200.0), show:() => ui.sliceSupportEnable.checked, trace2:false }),
separator: newBlank({ class:"set-sep", driven }), separator: newBlank({ class:"set-sep", driven }),
sliceSupportEnable: newBoolean(LANG.sp_auto_s, onBooleanClick, {title:LANG.sp_auto_l, show:isNotBelt}), sliceSupportEnable: newBoolean(LANG.sp_auto_s, onBooleanClick, {title:LANG.sp_auto_l, show:isNotBelt}),
sliceSupportOutline: newBoolean(LANG.sp_outl_s, onBooleanClick, {title:LANG.sp_outl_l}), sliceSupportOutline: newBoolean(LANG.sp_outl_s, onBooleanClick, {title:LANG.sp_outl_l}),

View file

@ -855,7 +855,6 @@ gapp.register("kiri.main", [], (root, exports) => {
api.widgets.opacity(1); api.widgets.opacity(1);
break; break;
case VIEWS.SLICE: case VIEWS.SLICE:
UI.back.style.display = 'flex';
if (isCAM) UI.render.classList.add('hide'); if (isCAM) UI.render.classList.add('hide');
else UI.render.classList.remove('hide'); else UI.render.classList.remove('hide');
updateSpeeds(); updateSpeeds();
@ -863,7 +862,6 @@ gapp.register("kiri.main", [], (root, exports) => {
setWidgetVisibility(true); setWidgetVisibility(true);
break; break;
case VIEWS.PREVIEW: case VIEWS.PREVIEW:
UI.back.style.display = 'flex';
if (isCAM) UI.render.classList.add('hide'); if (isCAM) UI.render.classList.add('hide');
else UI.render.classList.remove('hide'); else UI.render.classList.remove('hide');
setWidgetVisibility(true); setWidgetVisibility(true);
@ -906,15 +904,6 @@ gapp.register("kiri.main", [], (root, exports) => {
options.selectedIndex = optlist.indexOf(mode); options.selectedIndex = optlist.indexOf(mode);
modename.onchange = (ev) => setMode(optlist[options.selectedIndex]); modename.onchange = (ev) => setMode(optlist[options.selectedIndex]);
} }
// highlight relevant device mode button
// ["fdm","sla","cam","laser"].forEach(dev => {
// let cl = $(`mode-${dev}`).classList;
// if (dev === mode.toLowerCase()) {
// cl.add("dev-sel");
// } else {
// cl.remove("dev-sel");
// }
// });
// restore cached device profile for this mode // restore cached device profile for this mode
if (current.cdev[mode]) { if (current.cdev[mode]) {
current.device = clone(current.cdev[mode]); current.device = clone(current.cdev[mode]);

View file

@ -21,8 +21,8 @@ gapp.register("kiri.ui", [], (root, exports) => {
hasModes = [], hasModes = [],
isExpert = [], isExpert = [],
setters = [], setters = [],
letMode = null, lastMode = null,
letExpert = true, lastExpert = true,
letHoverPop = true, letHoverPop = true,
exitimer = undefined, exitimer = undefined,
NOMODE = "nomode", NOMODE = "nomode",
@ -168,7 +168,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
} }
function refresh(all) { function refresh(all) {
setMode(letMode, all ? false : true); setMode(lastMode, all ? false : true);
setters.forEach(input => { setters.forEach(input => {
if (input.setv) { if (input.setv) {
input.setv(input.real); input.setv(input.real);
@ -177,10 +177,11 @@ gapp.register("kiri.ui", [], (root, exports) => {
} }
function setMode(mode, nohide) { function setMode(mode, nohide) {
console.log({ gs: groupShow });
Object.keys(groupShow).forEach(group => { Object.keys(groupShow).forEach(group => {
updateGroupShow(group); updateGroupShow(group);
}); });
letMode = mode; lastMode = mode;
if (nohide) { if (nohide) {
for (let div of hasModes.filter(d => d.isBlank)) { for (let div of hasModes.filter(d => d.isBlank)) {
div.setMode(div._group && !groupShow[div._group] ? NOMODE : mode); div.setMode(div._group && !groupShow[div._group] ? NOMODE : mode);
@ -194,8 +195,8 @@ gapp.register("kiri.ui", [], (root, exports) => {
} }
function setExpert(bool) { function setExpert(bool) {
// letExpert = bool; // lastExpert = bool;
// setMode(letMode); // setMode(lastMode);
} }
function setHoverPop(bool) { function setHoverPop(bool) {
@ -243,25 +244,11 @@ gapp.register("kiri.ui", [], (root, exports) => {
function newGroup(label, div, opt = {}) { function newGroup(label, div, opt = {}) {
lastDiv = div = (div || lastDiv); lastDiv = div = (div || lastDiv);
opt.inline = true; let group = opt.group || label,
row = DOC.createElement('div'),
let group = opt.group || label;
let row = DOC.createElement('div'),
dbkey = `beta-${prefix}-show-${group}`, dbkey = `beta-${prefix}-show-${group}`,
link; link;
// if (opt.separator) {
// const sep = DOC.createElement('div');
// sep.classList.add('set2-sep');
// sep.innerHTML = [
// '<div class="line-sep2"></div>',
// '<div class="chonk"></div>',
// '<div class="line-sep2"></div>',
// ].join('');
// lastDiv.appendChild(sep);
// }
if (opt.class) { if (opt.class) {
opt.class.split(' ').forEach(ce => { opt.class.split(' ').forEach(ce => {
row.classList.add(ce); row.classList.add(ce);
@ -283,17 +270,6 @@ gapp.register("kiri.ui", [], (root, exports) => {
row.appendChild(link); row.appendChild(link);
} }
// if (opt.separator) {
// const sep = DOC.createElement('div');
// sep.classList.add('set2-sep');
// sep.innerHTML = [
// '<div class="line-sep2"></div>',
// '<div class="chonk2"></div>',
// '<div class="line-sep2"></div>',
// ].join('');
// lastDiv.appendChild(sep);
// }
addModeControls(row, opt); addModeControls(row, opt);
lastGroup = groups[group] = []; lastGroup = groups[group] = [];
lastGroup.key = dbkey; lastGroup.key = dbkey;
@ -342,7 +318,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
// console.log({ updateGroupShow: groupname, show: groupShow[groupname] }); // console.log({ updateGroupShow: groupname, show: groupShow[groupname] });
let group = groups[groupname]; let group = groups[groupname];
group.forEach(div => { group.forEach(div => {
if (show) div.setMode(letMode); if (show) div.setMode(lastMode);
else div.setMode(NOMODE); else div.setMode(NOMODE);
}); });
} }
@ -399,37 +375,34 @@ gapp.register("kiri.ui", [], (root, exports) => {
return label; return label;
} }
function addId(el, options) { function addId(el, opt = {}) {
if (options && options.id) { if (opt.id) {
el.setAttribute("id", options.id); el.setAttribute("id", opt.id);
} }
} }
function addModeControls(el, opt = {}) { function addModeControls(el, opt = {}) {
if (opt.trace2) {
console.log({ AMC: el, opt, groupName });
}
el.__opt = opt; el.__opt = opt;
el.__show = true;
el.__modeSave = null;
el.showMe = function() { el.showMe = function() {
if (el.__show) return; el.classList.remove('hide');
el.style.display = el.__modeSave;
el.__show = true;
el.__modeSave = null;
}; };
el.hideMe = function() { el.hideMe = function() {
if (!el.__show) return; el.classList.add('hide');
el.__show = false;
el.__modeSave = el.style.display;
el.style.display = 'none';
}; };
el.setVisible = function(show) { el.setVisible = function(show) {
if (opt.trace2) console.log({ setVisible: show, el });
if (show) el.showMe(); if (show) el.showMe();
else el.hideMe(); else el.hideMe();
}; };
el.setMode = function(mode) { el.setMode = function(mode) {
let show = opt.expert === undefined || (opt.expert === letExpert); let xprt = opt.expert === undefined || (opt.expert === lastExpert);
let test = !opt.show || (opt.show && opt.show()); let show = opt.show ? opt.show() : true;
let disp = opt.visible ? opt.visible() : true; let disp = opt.visible ? opt.visible() : true;
el.setVisible(el.hasMode(mode) && test && show && disp); if (opt.trace2) console.log({ setMode: el, xprt, show, disp, fn: el.__opt.show });
el.setVisible(el.hasMode(mode) && show && xprt && disp);
} }
el.hasMode = function(mode) { el.hasMode = function(mode) {
if (mode === NOMODE) return false; if (mode === NOMODE) return false;
@ -442,9 +415,9 @@ gapp.register("kiri.ui", [], (root, exports) => {
} }
} }
function newDiv(options) { function newDiv(opt = {}) {
let div = DOC.createElement('div'); let div = DOC.createElement('div');
addModeControls(div, options); addModeControls(div, opt);
addTo.appendChild(div); addTo.appendChild(div);
lastGroup.push(div); lastGroup.push(div);
div._group = groupName; div._group = groupName;
@ -476,7 +449,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
function newGCode(label, options) { function newGCode(label, options) {
let opt = options || {}, let opt = options || {},
row = lastDiv, // row = lastDiv,
btn = DOC.createElement("button"), btn = DOC.createElement("button"),
txt = DOC.createElement("textarea"), txt = DOC.createElement("textarea"),
area = opt.area; area = opt.area;
@ -608,12 +581,11 @@ gapp.register("kiri.ui", [], (root, exports) => {
return txt; return txt;
} }
function newInput(label, options) { function newInput(label, opt = {}) {
let opt = options || {}, let row = newDiv(opt),
row = newDiv(opt), hide = opt.hide,
hide = opt && opt.hide, size = opt.size || 5,
size = opt ? opt.size || 5 : 5, height = opt.height || 0,
height = opt ? opt.height : 0,
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'), ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
action = opt.action || bindTo || inputAction; action = opt.action || bindTo || inputAction;
@ -634,13 +606,11 @@ gapp.register("kiri.ui", [], (root, exports) => {
ip.setAttribute("type", "text"); ip.setAttribute("type", "text");
ip.setAttribute("spellcheck", "false"); ip.setAttribute("spellcheck", "false");
row.style.display = hide ? 'none' : ''; row.style.display = hide ? 'none' : '';
if (opt) {
if (opt.disabled) ip.setAttribute("disabled", "true"); if (opt.disabled) ip.setAttribute("disabled", "true");
if (opt.title) row.setAttribute("title", opt.title); if (opt.title) row.setAttribute("title", opt.title);
if (opt.convert) ip.convert = opt.convert.bind(ip); if (opt.convert) ip.convert = opt.convert.bind(ip);
if (opt.bound) ip.bound = opt.bound; if (opt.bound) ip.bound = opt.bound;
if (opt.action) action = opt.action; if (opt.action) action = opt.action;
}
ip.addEventListener('focus', function(event) { ip.addEventListener('focus', function(event) {
hidePop(); hidePop();
setSticky(true); setSticky(true);
@ -690,11 +660,10 @@ gapp.register("kiri.ui", [], (root, exports) => {
return ip; return ip;
} }
function newInput2(options) { function newInput2(opt = {}) {
let opt = options || {}, let hide = opt.hide,
hide = opt && opt.hide, size = opt.size || 5,
size = opt ? opt.size || 5 : 5, height = opt.height || 0,
height = opt ? opt.height : 0,
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'), ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
action = opt.action || bindTo || inputAction; action = opt.action || bindTo || inputAction;
@ -706,13 +675,11 @@ gapp.register("kiri.ui", [], (root, exports) => {
} }
ip.setAttribute("type", "text"); ip.setAttribute("type", "text");
ip.setAttribute("spellcheck", "false"); ip.setAttribute("spellcheck", "false");
if (opt) {
if (opt.disabled) ip.setAttribute("disabled", "true"); if (opt.disabled) ip.setAttribute("disabled", "true");
if (opt.title) ip.setAttribute("title", opt.title); if (opt.title) ip.setAttribute("title", opt.title);
if (opt.convert) ip.convert = opt.convert.bind(ip); if (opt.convert) ip.convert = opt.convert.bind(ip);
if (opt.bound) ip.bound = opt.bound; if (opt.bound) ip.bound = opt.bound;
if (opt.action) action = opt.action; if (opt.action) action = opt.action;
}
ip.addEventListener('focus', function(event) { ip.addEventListener('focus', function(event) {
hidePop(); hidePop();
setSticky(true); setSticky(true);
@ -732,7 +699,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
key === 'Tab' || key === 'Tab' ||
event.metaKey || event.metaKey ||
event.ctrlKey || event.ctrlKey ||
(key === ',' && options.comma) (key === ',' && opt.comma)
) { ) {
return; return;
} }
@ -838,10 +805,10 @@ gapp.register("kiri.ui", [], (root, exports) => {
return ip; return ip;
} }
function newBoolean(label, action = bindTo, options) { function newBoolean(label, action = bindTo, opt = {}) {
let row = newDiv(options), let row = newDiv(opt),
ip = DOC.createElement('input'), ip = DOC.createElement('input'),
hide = options && options.hide; hide = opt.hide;
if (label) { if (label) {
row.appendChild(newLabel(label)); row.appendChild(newLabel(label));
@ -851,17 +818,20 @@ gapp.register("kiri.ui", [], (root, exports) => {
row.style.display = hide ? 'none' : ''; row.style.display = hide ? 'none' : '';
ip.setAttribute("type", "checkbox"); ip.setAttribute("type", "checkbox");
ip.checked = false; ip.checked = false;
if (options) { if (opt.disabled) {
if (options.disabled) {
ip.setAttribute("disabled", "true"); ip.setAttribute("disabled", "true");
} }
if (options.title) { if (opt.title) {
ip.setAttribute("title", options.title); ip.setAttribute("title", opt.title);
row.setAttribute("title", options.title); row.setAttribute("title", opt.title);
}
} }
if (action) { if (action) {
ip.onclick = function(ev) { action(ip) }; ip.onclick = function(ev) {
action(ip);
if (opt.trigger) {
refresh();
}
};
} }
ip.setVisible = row.setVisible; ip.setVisible = row.setVisible;

View file

@ -111,7 +111,7 @@ input {
position: relative; position: relative;
} }
input:focus { input:focus {
color: #495057; /* color: #495057; */
outline: 0; outline: 0;
box-shadow: 0 0 0 0.2rem rgb(0 100 255 / 10%); box-shadow: 0 0 0 0.2rem rgb(0 100 255 / 10%);
} }
@ -232,7 +232,7 @@ th, tr, td, label {
align-items: center; align-items: center;
} }
.top-menu > span:hover label { .top-menu > span:hover label {
color: var(--menu-hover); color: #000;
} }
.dark .top-menu > span:hover label { .dark .top-menu > span:hover label {
color: var(--dark-menu-text) !important; color: var(--dark-menu-text) !important;
@ -1064,7 +1064,7 @@ th, tr, td, label {
background-color: rgba(150,150,150,0.5) !important; background-color: rgba(150,150,150,0.5) !important;
} }
#oplist .disabled { #oplist .disabled {
background-color: rgba(220,150,150,0.5) !important; background-color: rgba(125,125,125,0.5) !important;
} }
#oplist div .label { #oplist div .label {
pointer-events: none; pointer-events: none;

View file

@ -325,11 +325,6 @@
<div class="set-header mode-cam"> <div class="set-header mode-cam">
<a>operation list</a> <a>operation list</a>
</div> </div>
<div class="set2-set f-col">
<div class="line-sep2"></div>
<div class="chonk2"></div>
<div class="line-sep2"></div>
</div>
<div id="camops" class="f-col a-stretch grow"> <div id="camops" class="f-col a-stretch grow">
<div id="oplist" class="f-col j-center"></div> <div id="oplist" class="f-col j-center"></div>
<div id="op-add" class="opdiv"> <div id="op-add" class="opdiv">