bind some menu items. add loading screen. use vars in css

This commit is contained in:
Stewart Allen 2020-06-06 16:02:04 -04:00
commit 48f918b177
4 changed files with 79 additions and 46 deletions

View file

@ -1084,19 +1084,23 @@
text: $('alert-text')
},
container: container,
assets: assets,
control: control,
ctrlLeft: $('control-left'),
ctrlRight: $('control-right'),
layerView: $('layer-view'),
layerSlider: $('layer-slider'),
modelOpacity: $('opacity'),
// assets: assets,
// control: control,
// ctrlLeft: $('control-left'),
// ctrlRight: $('control-right'),
// layerView: $('layer-view'),
// layerSlider: $('layer-slider'),
// modelOpacity: $('opacity'),
menusep: $('lt-sep'),
rotate: $('lt-rotate'),
scale: $('lt-scale'),
modal: $('modal'),
help: $('mod-help'),
print: $('mod-print'),
local: $('mod-local'),
files: $('mod-files'),
setup: $('mod-setup'),
catalogBody: $('catalogBody'),
catalogList: $('catalogList'),
@ -1579,7 +1583,17 @@
// UI.toolMetric.onclick = updateTool;
// UI.toolType.onchange = updateTool;
// bind interface action elements
$('app-name').onclick = API.help.show;
$('lt-setup').onclick = () => { API.modal.show('setup') };
$('file-recent').onclick = () => { API.modal.show('files') };
$('file-import').onclick = API.event.import;
$('act-slice').onclick = API.function.slice;
$('act-preview').onclick = API.function.print;
$('act-export').onclick = API.function.export;
$('view-arrange').onclick = API.platform.layout;
$('view-top').onclick = SPACE.view.top;
$('view-home').onclick = SPACE.view.home;
SPACE.platform.setSize(
settings().device.bedWidth,
@ -1670,8 +1684,6 @@
let current = settings(),
control = current.controller;
SPACE.scene.freeze(true);
platform.deselect();
CATALOG.addFileListener(updateCatalog);
SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed);
@ -1765,9 +1777,6 @@
// add ability to override
API.show.controls(API.feature.controls);
// show version on startup
$('app-vers').innerHTML = KIRI.version;
// enable modal hiding
$('mod-x').onclick = API.modal.hide;
@ -1776,7 +1785,8 @@
// send init-done event
API.event.emit('init-done', STATS);
SPACE.scene.freeze(false);
// lift curtain
$('curtain').style.display = 'none';
}
// if a language needs to load, the script is injected and loaded

View file

@ -1018,7 +1018,10 @@
}
function platformUpdateSelected() {
// UI.selection.style.display = platform.selected_count() ? 'inline' : 'none';
let menu_show = platform.selected_count() ? 'flex': '';
UI.scale.style.display = menu_show;
UI.rotate.style.display = menu_show;
UI.menusep.style.display = menu_show;
// $('ext-sel').style.display = (MODE === MODES.FDM) ? 'inline-block' : 'none';
let extruders = settings.device.extruders;
if (extruders) {
@ -1627,7 +1630,7 @@
visible = modalShowing(),
info = { pct: 0 };
["print","help","files","local"].forEach(function(name) {
["setup","print","help","files","local"].forEach(function(name) {
UI[name].style.display = name === which ? 'flex' : '';
});
@ -1652,6 +1655,7 @@
}
function hideModal() {
// console.trace({hideModal: modalShowing()});
if (!modalShowing()) {
return;
}
@ -1664,16 +1668,8 @@
start();
}
function hideDialog() {
hideModal();
}
function showDialog(which) {
showModal(which);
}
function showCatalog() {
showDialog("files");
showModal("files");
}
function getSettings() {
@ -1730,7 +1726,7 @@
}
if (!named) {
hideDialog();
hideModal();
}
updateFields();
@ -1787,7 +1783,7 @@
function showSettings() {
updateSettingsList();
showDialog("settings");
showModal("settings");
}
function updateDialogLeft() {
@ -1805,7 +1801,7 @@
}
function showHelpFile(local) {
hideDialog();
hideModal();
if (!local) {
WIN.open("//wiki.grid.space/wiki/Kiri:Moto", "_help");
return;
@ -1923,11 +1919,11 @@
function setMode(mode, lock, then) {
hideModal();
hideDialog();
if (!MODES[mode]) {
DBUG.log("invalid mode: "+mode);
mode = 'FDM';
}
$('app-mode').innerHTML = mode;
settings.mode = mode;
// restore cached device profile for this mode
if (settings.cdev[mode]) {