begin refactor of 4.x ui
This commit is contained in:
parent
4caa57bf6d
commit
25c1959e57
11 changed files with 375 additions and 278 deletions
|
|
@ -12,7 +12,7 @@
|
|||
// dep: kiri-mode.laser.driver
|
||||
gapp.register("kiri.function", [], (root, exports) => {
|
||||
|
||||
const { kiri, noop } = root;
|
||||
const { kiri } = root;
|
||||
const { api, client, consts, utils } = kiri;
|
||||
const { space } = moto;
|
||||
const { COLOR, PMODES } = consts;
|
||||
|
|
@ -427,6 +427,7 @@ function parseCode(code, type) {
|
|||
});
|
||||
}
|
||||
|
||||
// extend API (api.function)
|
||||
const functions = api.function = {
|
||||
slice: prepareSlices,
|
||||
print: preparePreview,
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
function speedSave() {
|
||||
settings().controller.showSpeeds = ui.showSpeeds.checked;
|
||||
api.platform.update_speeds();
|
||||
api.view.update_speeds();
|
||||
}
|
||||
|
||||
function zAnchorSave() {
|
||||
|
|
@ -808,9 +808,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
selext.innerHTML = '';
|
||||
for (let i=0; i<dev.extruders.length; i++) {
|
||||
let d = DOC.createElement('div');
|
||||
d.appendChild(DOC.createTextNode(i));
|
||||
d.innerHTML = `<label>extruder ${i}</label>`;
|
||||
d.setAttribute('id', `sel-ext-${i}`);
|
||||
d.setAttribute('class', 'col j-center');
|
||||
d.onclick = function() {
|
||||
api.selection.for_widgets(w => {
|
||||
api.widgets.annotate(w.id).extruder = i;
|
||||
|
|
@ -1621,8 +1620,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
export: $('label-export'),
|
||||
},
|
||||
acct: {
|
||||
help: $('acct-help'),
|
||||
export: $('acct-export')
|
||||
help: $('app-help'),
|
||||
export: $('app-export')
|
||||
},
|
||||
dev: {
|
||||
header: $('dev-header'),
|
||||
|
|
@ -1660,8 +1659,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
ltview: $('lt-view'),
|
||||
ltact: $('lt-start'),
|
||||
edit: $('lt-tools'),
|
||||
nozzle: $('lt-nozzle'),
|
||||
render: $('lt-render'),
|
||||
nozzle: $('menu-nozzle'),
|
||||
render: $('menu-render'),
|
||||
|
||||
modal: $('modal'),
|
||||
modalBox: $('modal-box'),
|
||||
|
|
@ -2452,22 +2451,10 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
}
|
||||
};
|
||||
|
||||
if (DOC.body.requestFullscreen) {
|
||||
$('app-xpnd').style.display = 'flex';
|
||||
if (!DOC.body.requestFullscreen) {
|
||||
$('app-xpnd').style.display = 'none';
|
||||
}
|
||||
|
||||
let hpops = [];
|
||||
uc.hoverPop(ui.ltsetup, { group: hpops, target: $('set-pop') });
|
||||
uc.hoverPop(ui.ltfile, { group: hpops, target: $('file-pop') });
|
||||
uc.hoverPop(ui.ltview, { group: hpops, target: $('pop-view') });
|
||||
uc.hoverPop(ui.ltact, { group: hpops, target: $('pop-slice') });
|
||||
uc.hoverPop(ui.render, { group: hpops, target: $('pop-render'), xsticky: false });
|
||||
uc.hoverPop(ui.edit, { group: hpops, target: $('pop-tools'), xsticky: false });
|
||||
uc.hoverPop(ui.nozzle, { group: hpops, target: $('pop-nozzle'), xsticky: true });
|
||||
uc.hoverPop($('app-acct'), { group: hpops, target: $('acct-pop') } );
|
||||
// uc.hoverPop($('app-mode'), { group: hpops, target: $('mode-info') } );
|
||||
uc.hoverPop($('app-name'), { group: hpops, target: $('app-info') } );
|
||||
|
||||
uc.onBlur([
|
||||
ui.toolName,
|
||||
ui.toolNum,
|
||||
|
|
@ -2814,7 +2801,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
// bind interface action elements
|
||||
$('app-name').onclick = api.help.show;
|
||||
$('app-mode').onclick = (ev) => { ev.stopPropagation(); showDevices() };
|
||||
$('app-state').onclick = (ev) => { ev.stopPropagation(); showDevices() };
|
||||
$('set-device').onclick = (ev) => { ev.stopPropagation(); showDevices() };
|
||||
$('set-tools').onclick = (ev) => { ev.stopPropagation(); showTools() };
|
||||
$('set-prefs').onclick = (ev) => { ev.stopPropagation(); api.modal.show('prefs') };
|
||||
|
|
|
|||
|
|
@ -861,14 +861,16 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
break;
|
||||
case VIEWS.SLICE:
|
||||
UI.back.style.display = 'flex';
|
||||
if (!isCAM) UI.render.classList.remove('lt-enabled');
|
||||
if (isCAM) UI.render.classList.add('hide');
|
||||
else UI.render.classList.remove('hide');
|
||||
updateSpeeds();
|
||||
updateSliderMax();
|
||||
setWidgetVisibility(true);
|
||||
break;
|
||||
case VIEWS.PREVIEW:
|
||||
UI.back.style.display = 'flex';
|
||||
if (!isCAM) UI.render.classList.remove('lt-enabled');
|
||||
if (isCAM) UI.render.classList.add('hide');
|
||||
else UI.render.classList.remove('hide');
|
||||
setWidgetVisibility(true);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ function platformUpdateSelected() {
|
|||
let disC = selwid.filter(w => w.meta.disabled === true).length;
|
||||
enable.style.display = disC ? 'flex' : 'none';
|
||||
disable.style.display = enaC ? 'flex' : 'none';
|
||||
ui.nozzle.classList.add('lt-active');
|
||||
ui.nozzle.classList.remove('hide');
|
||||
if (api.feature.meta && selcount === 1) {
|
||||
let sel = selwid[0];
|
||||
let name = sel.meta.file || sel.meta.url;
|
||||
|
|
@ -276,7 +276,7 @@ function platformUpdateSelected() {
|
|||
ui.mesh.name.innerText = '[0]';
|
||||
ui.mesh.points.innerText = '-';
|
||||
ui.mesh.faces.innerText = '-';
|
||||
ui.nozzle.classList.remove('lt-active');
|
||||
ui.nozzle.classList.add('hide');
|
||||
}
|
||||
|
||||
ui.nozzle.style.display = extruders && extruders.length > 1 ? 'flex' : '';
|
||||
|
|
@ -862,6 +862,7 @@ function fitDeviceToWidgets() {
|
|||
}
|
||||
}
|
||||
|
||||
// extend API (api.platform)
|
||||
const platform = api.platform = {
|
||||
fit: fitDeviceToWidgets,
|
||||
add: platformAdd,
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ function setDisabled(bool) {
|
|||
api.platform.update_selected();
|
||||
}
|
||||
|
||||
// extend API (api.selection)
|
||||
const selection = api.selection = {
|
||||
move,
|
||||
scale,
|
||||
|
|
|
|||
|
|
@ -733,6 +733,7 @@ function setEnableWASM(bool) {
|
|||
api.event.emit("set.assembly", bool);
|
||||
}
|
||||
|
||||
// extend API (api.conf)
|
||||
api.conf = {
|
||||
dbo: () => { return ls2o('ws-settings') },
|
||||
get: getSettings,
|
||||
|
|
@ -751,6 +752,7 @@ api.conf = {
|
|||
import: settingsImport,
|
||||
};
|
||||
|
||||
// extend API (api.settings)
|
||||
api.settings = {
|
||||
get: getSettings,
|
||||
import: settingsImport,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ function opacity(value) {
|
|||
moto.space.update();
|
||||
}
|
||||
|
||||
// extend API (api.widgets)
|
||||
const widgets = api.widgets = {
|
||||
load: Widget.loadFromCatalog,
|
||||
new: newWidget,
|
||||
|
|
|
|||
Loading…
Reference in a new issue