restart collapsable groups
This commit is contained in:
parent
76171c2474
commit
5551b33560
5 changed files with 44 additions and 32 deletions
|
|
@ -144,7 +144,7 @@ CAM.init = function(kiri, api) {
|
|||
isIndexed = undefined;
|
||||
isCamMode = mode === 'CAM';
|
||||
SPACE.platform.setColor(isCamMode ? 0xeeeeee : 0xcccccc);
|
||||
api.uc.setClass($('right-work'), 'slim-hide', isCamMode);
|
||||
api.uc.setClass($('right-work'), 'slim-hide', !isCamMode);
|
||||
api.uc.setVisible(UI.func.animate, isCamMode);
|
||||
if (!isCamMode) {
|
||||
func.clearPops();
|
||||
|
|
@ -162,7 +162,7 @@ CAM.init = function(kiri, api) {
|
|||
isAnimate = false;
|
||||
animFn().animate_clear(api);
|
||||
func.clearPops();
|
||||
api.uc.setClass($('right-work'), 'slim-hide', isCamMode);
|
||||
api.uc.setClass($('right-work'), 'slim-hide', !isCamMode);
|
||||
if (isCamMode && isPreview) {
|
||||
for (let widget of API.widgets.all()) {
|
||||
widget.setAxisIndex(0);
|
||||
|
|
|
|||
|
|
@ -1841,7 +1841,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
prefadd: uc.checkpoint($('prefs-add')),
|
||||
|
||||
process: uc.newGroup(LANG.sl_menu, $('settings'), {modes:FDM_LZR, class:"xdown"}),
|
||||
process: uc.newGroup(LANG.sl_menu, $('settings'), {modes:FDM_LZR}),
|
||||
sliceHeight: uc.newInput(LANG.sl_lahi_s, {title:LANG.sl_lahi_l, convert:uc.toFloat, modes:FDM}),
|
||||
sliceMinHeight: uc.newInput(LANG.ad_minl_s, {title:LANG.ad_minl_l, bound:uc.bound(0,3.0), convert:uc.toFloat, modes:FDM, show: () => ui.sliceAdaptive.checked}),
|
||||
fdmSep: uc.newBlank({class:"pop-sep", modes:FDM}),
|
||||
|
|
@ -1861,7 +1861,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
laserSep: uc.newBlank({class:"pop-sep", modes:LASER}),
|
||||
laserSliceSingle: uc.newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l, modes:LASER}),
|
||||
|
||||
firstLayer: uc.newGroup(LANG.fl_menu, null, {modes:FDM, class:"xdown"}),
|
||||
firstLayer: uc.newGroup(LANG.fl_menu, null, {modes:FDM}),
|
||||
firstSliceHeight: uc.newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:uc.toFloat, modes:FDM, show:isNotBelt}),
|
||||
fdmSep: uc.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}),
|
||||
firstLayerNozzleTemp:uc.newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:uc.toInt, modes:FDM, show:isNotBelt}),
|
||||
|
|
@ -1947,26 +1947,26 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
camStockX: uc.newInput(LANG.cs_wdth_s, {title:LANG.cs_wdth_l, convert:uc.toFloat, bound:uc.bound(0,9999), modes:CAM, units:true}),
|
||||
camStockY: uc.newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_l, convert:uc.toFloat, bound:uc.bound(0,9999), modes:CAM, units:true}),
|
||||
camStockZ: uc.newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:uc.toFloat, bound:uc.bound(0,9999), modes:CAM, units:true}),
|
||||
camSep: uc.newBlank({class:"pop-sep"}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
|
||||
camStockOffset: uc.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
|
||||
camStockClipTo: uc.newBoolean(LANG.cs_clip_s, onBooleanClick, {title:LANG.cs_clip_l, modes:CAM}),
|
||||
camSep: uc.newBlank({class:"pop-sep"}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
|
||||
camStockIndexGrid: uc.newBoolean(LANG.cs_ishg_s, onBooleanClick, {title:LANG.cs_ishg_l, modes:CAM, show:() => ui.camStockIndexed.checked}),
|
||||
camStockIndexed: uc.newBoolean(LANG.cs_indx_s, onBooleanClick, {title:LANG.cs_indx_l, modes:CAM}),
|
||||
|
||||
camCommon: uc.newGroup(LANG.cc_menu, null, {modes:CAM}),
|
||||
camZAnchor: uc.newSelect(LANG.ou_zanc_s, {title: LANG.ou_zanc_l, action:zAnchorSave, modes:CAM, trace:true, show:() => !ui.camStockIndexed.checked}, "zanchor"),
|
||||
camSep: uc.newBlank({class:"pop-sep", show:() => !ui.camStockIndexed.checked}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM, show:() => !ui.camStockIndexed.checked}),
|
||||
camZOffset: uc.newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:uc.toFloat, modes:CAM, units:true}),
|
||||
camZBottom: uc.newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:uc.toFloat, modes:CAM, units:true, trigger: true}),
|
||||
camZThru: uc.newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:uc.toFloat, bound:uc.bound(0.0,100), modes:CAM, units:true, show:() => { return ui.camZBottom.value == 0 }}),
|
||||
camSep: uc.newBlank({class:"pop-sep"}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
|
||||
camZClearance: uc.newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:uc.toFloat, bound:uc.bound(0.01,100), modes:CAM, units:true}),
|
||||
camSep: uc.newBlank({class:"pop-sep"}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
|
||||
camFastFeedZ: uc.newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:uc.toFloat, modes:CAM, units:true}),
|
||||
camFastFeed: uc.newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:uc.toFloat, modes:CAM, units:true}),
|
||||
|
||||
laserLayout: uc.newGroup(LANG.lo_menu, null, {modes:LASER, group:"lz-lo"}),
|
||||
laserLayout: uc.newGroup(LANG.lo_menu, null, {modes:LASER}),
|
||||
outputTileSpacing: uc.newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:uc.toInt, modes:LASER}),
|
||||
outputLaserMerged: uc.newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l, modes:LASER}),
|
||||
outputLaserGroup: uc.newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l, modes:LASER}),
|
||||
|
|
@ -1978,7 +1978,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
knifeSep: uc.newBlank({class:"pop-sep", modes:LASER}),
|
||||
knifeOn: uc.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ou_drkn_l, modes:LASER}),
|
||||
|
||||
output: uc.newGroup(LANG.ou_menu, null, {class: "fdmout", modes:GCODE}),
|
||||
output: uc.newGroup(LANG.ou_menu, null, {modes:GCODE}),
|
||||
outputLaserPower: uc.newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:uc.toInt, bound:uc.bound(1,100), modes:LASER}),
|
||||
outputLaserSpeed: uc.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:uc.toInt, modes:LASER}),
|
||||
laserSep: uc.newBlank({class:"pop-sep", modes:LASER}),
|
||||
|
|
@ -2016,7 +2016,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
outputOriginBounds: uc.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
|
||||
outputOriginCenter: uc.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:LASER}),
|
||||
|
||||
camOrigin: uc.newGroup(LANG.co_menu, null, {modes:CAM, xgroup:"cam_origin"}),
|
||||
camOrigin: uc.newGroup(LANG.co_menu, null, {modes:CAM}),
|
||||
camOriginTop: uc.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),
|
||||
camOriginCenter: uc.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM}),
|
||||
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
|
||||
|
|
@ -2028,7 +2028,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
camExpertFast: uc.newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, modes:CAM, show: () => !ui.camTrueShadow.checked }),
|
||||
camTrueShadow: uc.newBoolean(LANG.cx_true_s, onBooleanClick, {title:LANG.cx_true_l, modes:CAM, show: () => !ui.camExpertFast.checked }),
|
||||
|
||||
advanced: uc.newGroup(LANG.ad_menu, null, {modes:FDM, class:"fdmadv"}),
|
||||
advanced: uc.newGroup(LANG.ad_menu, null, {modes:FDM}),
|
||||
outputRetractDist: uc.newInput(LANG.ad_rdst_s, {title:LANG.ad_rdst_l, convert:uc.toFloat, modes:FDM}),
|
||||
outputRetractSpeed: uc.newInput(LANG.ad_rrat_s, {title:LANG.ad_rrat_l, convert:uc.toInt, modes:FDM}),
|
||||
outputRetractWipe: uc.newInput(LANG.ad_wpln_s, {title:LANG.ad_wpln_l, bound:uc.bound(0.0,10), convert:uc.toFloat, modes:FDM}),
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
groupShow = {},
|
||||
groupSticky = false,
|
||||
groupName = undefined,
|
||||
poppable = {},
|
||||
hasModes = [],
|
||||
isExpert = [],
|
||||
setters = [],
|
||||
|
|
@ -84,9 +83,9 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
},
|
||||
setClass(el, clazz, bool) {
|
||||
if (bool) {
|
||||
el.classList.remove(clazz);
|
||||
} else {
|
||||
el.classList.add(clazz);
|
||||
} else {
|
||||
el.classList.remove(clazz);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -248,8 +247,9 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
|
||||
function addCollapsableGroup(label, div, opt = {}) {
|
||||
|
||||
opt.inline = true;
|
||||
|
||||
let group = opt.group || label;
|
||||
poppable[group] = opt.inline === true ? false : true;
|
||||
|
||||
let row = DOC.createElement('div'),
|
||||
dbkey = `beta-${prefix}-show-${group}`,
|
||||
|
|
@ -299,6 +299,7 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
if (ev.target !== link && ev.target !== row) {
|
||||
return;
|
||||
}
|
||||
console.log({ toggleGroup: group, dbkey });
|
||||
toggleGroup(group, dbkey);
|
||||
};
|
||||
if (popper) {
|
||||
|
|
@ -354,20 +355,22 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
function showGroup(groupname) {
|
||||
Object.keys(groups).forEach(name => {
|
||||
let group = groups[name];
|
||||
groupShow[name] = state[group.key] = (groupname === name);
|
||||
groupShow[name] = true;//state[group.key] = (groupname === name);
|
||||
updateGroupShow(name);
|
||||
});
|
||||
groupSticky = false;
|
||||
}
|
||||
|
||||
function toggleGroup(groupname, dbkey) {
|
||||
let show = state[dbkey] === 'false';
|
||||
groupShow[groupname] = poppable[groupname] ? state[dbkey] = show : true;
|
||||
let show = state[dbkey] === 'true' || state[dbkey] === true;
|
||||
groupShow[groupname] = state[dbkey] = !show;
|
||||
// console.log({ state, show });
|
||||
updateGroupShow(groupname);
|
||||
}
|
||||
|
||||
function updateGroupShow(groupname) {
|
||||
let show = groupShow[groupname] || !poppable[groupname];
|
||||
let show = groupShow[groupname] ?? true;
|
||||
// console.log({ updateGroupShow: groupname, show: groupShow[groupname] });
|
||||
let group = groups[groupname];
|
||||
group.forEach(div => {
|
||||
if (show) div.setMode(letMode);
|
||||
|
|
|
|||
Loading…
Reference in a new issue