ui fixups with conditional show, z bottom with no widgets
This commit is contained in:
parent
1333acd91b
commit
0d1d8ec7d5
2 changed files with 23 additions and 14 deletions
|
|
@ -20,7 +20,7 @@ let isAnimate,
|
||||||
current,
|
current,
|
||||||
poppedRec,
|
poppedRec,
|
||||||
hoveredOp,
|
hoveredOp,
|
||||||
API, FDM, SPACE, STACKS, MODES, VIEWS, UI, UC, LANG;
|
API, FDM, SPACE, STACKS, MODES, VIEWS, UI, UC, LANG, MCAM;
|
||||||
|
|
||||||
let zaxis = { x: 0, y: 0, z: 1 },
|
let zaxis = { x: 0, y: 0, z: 1 },
|
||||||
popOp = {},
|
popOp = {},
|
||||||
|
|
@ -42,10 +42,15 @@ CAM.init = function(kiri, api) {
|
||||||
VIEWS = kiri.consts.VIEWS;
|
VIEWS = kiri.consts.VIEWS;
|
||||||
STACKS = api.const.STACKS;
|
STACKS = api.const.STACKS;
|
||||||
LANG = api.const.LANG;
|
LANG = api.const.LANG;
|
||||||
|
MCAM = [ MODES.CAM ];
|
||||||
UI = api.ui;
|
UI = api.ui;
|
||||||
UC = api.uc;
|
UC = api.uc;
|
||||||
API = api;
|
API = api;
|
||||||
|
|
||||||
|
function zBottom() {
|
||||||
|
return API.conf.get().process.camZBottom > 0;
|
||||||
|
}
|
||||||
|
|
||||||
// wire up animate button in ui
|
// wire up animate button in ui
|
||||||
api.event.on("function.animate", (mode) => {
|
api.event.on("function.animate", (mode) => {
|
||||||
if (isAnimate) {
|
if (isAnimate) {
|
||||||
|
|
@ -1072,7 +1077,7 @@ CAM.init = function(kiri, api) {
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
curves: UC.newBoolean(LANG.cf_curv_s, undefined, {title:LANG.cf_curv_l}),
|
||||||
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l}),
|
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l}),
|
||||||
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf.process.camZBottom})
|
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf ? conf.process.camZBottom : 0})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('trace', {
|
createPopOp('trace', {
|
||||||
|
|
@ -1088,18 +1093,18 @@ CAM.init = function(kiri, api) {
|
||||||
select: 'camTraceMode'
|
select: 'camTraceMode'
|
||||||
}).inputs = {
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
select: UC.newSelect(LANG.cc_sele_s, {title:LANG.cc_sele_l}, "select"),
|
||||||
mode: UC.newSelect(LANG.cu_type_s, {title:LANG.cu_type_l}, "trace"),
|
mode: UC.newSelect(LANG.cu_type_s, {title:LANG.cu_type_l}, "trace"),
|
||||||
offset: UC.newSelect(LANG.cc_offs_s, {title: LANG.cc_offs_l, show:() => (poppedRec.mode === 'follow')}, "traceoff"),
|
offset: UC.newSelect(LANG.cc_offs_s, {title: LANG.cc_offs_l, show:() => (poppedRec.mode === 'follow')}, "traceoff"),
|
||||||
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
||||||
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), show:(op) => popOp.trace.rec.mode === "clear"}),
|
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0), show:(op) => popOp.trace.rec.mode === "clear"}),
|
||||||
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true}),
|
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true}),
|
||||||
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
|
||||||
plunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, units:true}),
|
plunge: UC.newInput(LANG.cc_plng_s, {title:LANG.cc_plng_l, convert:UC.toInt, units:true}),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep", modes:MCAM, show:zBottom, poop:true }),
|
||||||
select: UC.newSelect(LANG.cc_sele_s, {title:LANG.cc_sele_l}, "select"),
|
|
||||||
sep: UC.newBlank({class:"pop-sep", show:(op,conf) => conf.process.camZBottom}),
|
|
||||||
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf.process.camZBottom}),
|
bottom: UC.newBoolean(LANG.cf_botm_s, undefined, {title:LANG.cf_botm_l, show:(op,conf) => conf.process.camZBottom}),
|
||||||
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
menu: UC.newRow([
|
menu: UC.newRow([
|
||||||
UC.newButton(undefined, func.traceAdd, {icon:'<i class="fas fa-plus"></i>'}),
|
UC.newButton(undefined, func.traceAdd, {icon:'<i class="fas fa-plus"></i>'}),
|
||||||
UC.newButton(undefined, func.traceDone, {icon:'<i class="fas fa-check"></i>'}),
|
UC.newButton(undefined, func.traceDone, {icon:'<i class="fas fa-check"></i>'}),
|
||||||
|
|
@ -1181,8 +1186,8 @@ CAM.init = function(kiri, api) {
|
||||||
invert: 'camFlipInvert'
|
invert: 'camFlipInvert'
|
||||||
}).inputs = {
|
}).inputs = {
|
||||||
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
||||||
sep: UC.newBlank({class:"pop-sep", show:(op,conf) => conf.process.camZBottom}),
|
sep: UC.newBlank({class:"pop-sep", modes:MCAM, show:zBottom}),
|
||||||
invert: UC.newBoolean(LANG.cf_nvrt_s, undefined, {title:LANG.cf_nvrt_l, show:(op,conf) => conf.process.camZBottom}),
|
invert: UC.newBoolean(LANG.cf_nvrt_s, undefined, {title:LANG.cf_nvrt_l, show:zBottom}),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
action: UC.newRow([
|
action: UC.newRow([
|
||||||
UC.newButton(LANG.cf_menu, func.opFlip)
|
UC.newButton(LANG.cf_menu, func.opFlip)
|
||||||
|
|
@ -1485,7 +1490,7 @@ function updateStock(args, event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SPACE.world.remove(camZBottom);
|
SPACE.world.remove(camZBottom);
|
||||||
if (proc.camZBottom) {
|
if (proc.camZBottom && widgets.length) {
|
||||||
let max = { x: csx, y: csy, z: csz };
|
let max = { x: csx, y: csy, z: csz };
|
||||||
for (let w of widgets) {
|
for (let w of widgets) {
|
||||||
max.x = Math.max(max.x, w.track.box.w);
|
max.x = Math.max(max.x, w.track.box.w);
|
||||||
|
|
|
||||||
|
|
@ -172,12 +172,12 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
||||||
updateGroupShow(group);
|
updateGroupShow(group);
|
||||||
});
|
});
|
||||||
letMode = mode;
|
letMode = mode;
|
||||||
if (nohide) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hasModes.forEach(function(div) {
|
hasModes.forEach(function(div) {
|
||||||
div.setMode(div._group && !groupShow[div._group] ? NOMODE : mode);
|
div.setMode(div._group && !groupShow[div._group] ? NOMODE : mode);
|
||||||
});
|
});
|
||||||
|
if (nohide) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
hidePoppers();
|
hidePoppers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -868,13 +868,17 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
||||||
ip.setAttribute("type", "checkbox");
|
ip.setAttribute("type", "checkbox");
|
||||||
ip.checked = false;
|
ip.checked = false;
|
||||||
if (options) {
|
if (options) {
|
||||||
if (options.disabled) ip.setAttribute("disabled", "true");
|
if (options.disabled) {
|
||||||
|
ip.setAttribute("disabled", "true");
|
||||||
|
}
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
ip.setAttribute("title", options.title);
|
ip.setAttribute("title", options.title);
|
||||||
row.setAttribute("title", options.title);
|
row.setAttribute("title", options.title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (action) ip.onclick = function(ev) { action(ip) };
|
if (action) {
|
||||||
|
ip.onclick = function(ev) { action(ip) };
|
||||||
|
}
|
||||||
ip.setVisible = row.setVisible;
|
ip.setVisible = row.setVisible;
|
||||||
|
|
||||||
return ip;
|
return ip;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue