fix output dialogs. add slider min/max shortcuts
This commit is contained in:
parent
7fed16a47c
commit
2f0eb9dbf8
11 changed files with 221 additions and 102 deletions
|
|
@ -113,7 +113,6 @@
|
|||
UI.print.innerHTML = html;
|
||||
$('print-filename').value = filename;
|
||||
$('print-lines').value = UTIL.comma(segments);
|
||||
$('print-close').onclick = API.modal.hide;
|
||||
$('print-svg').onclick = download_svg;
|
||||
$('print-dxf').onclick = download_dxf;
|
||||
$('print-lg').onclick = download_gcode;
|
||||
|
|
@ -213,7 +212,15 @@
|
|||
let dev = devs[uuid];
|
||||
html.push(`<option id="gl-${uuid}" value="${uuid}">${dev.stat.device.name}</option>`);
|
||||
}
|
||||
$('grid-local').innerHTML = html.join('\n');
|
||||
|
||||
if (html.length) {
|
||||
$('grid-local').innerHTML = html.join('\n');
|
||||
$('send-to-gridhead').style.display = 'flex';
|
||||
$('send-to-gridspool').style.display = 'flex';
|
||||
} else {
|
||||
$('send-to-gridhead').style.display = '';
|
||||
$('send-to-gridspool').style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function sendto_gridlocal() {
|
||||
|
|
@ -412,19 +419,18 @@
|
|||
mins = floor(newtime / 60),
|
||||
secs = newtime - mins * 60;
|
||||
|
||||
$('mill-time').value = $('print-time').value = [pad(hours),pad(mins),pad(secs)].join(':');
|
||||
$('output-time').value = [pad(hours),pad(mins),pad(secs)].join(':');
|
||||
}
|
||||
|
||||
API.ajax("/kiri/output-gcode.html", function(html) {
|
||||
UI.print.innerHTML = html;
|
||||
$('print-close').onclick = API.modal.hide;
|
||||
$('print-download').onclick = download;
|
||||
$('print-octoprint').onclick = sendto_octoprint;
|
||||
$('print-gridhost').onclick = sendto_gridhost;
|
||||
$('print-gridlocal').onclick = sendto_gridlocal;
|
||||
$('admin-gridlocal').onclick = admin_gridlocal;
|
||||
$('print-filament-row').style.display = MODE === MODES.FDM ? '' : 'none';
|
||||
$('mill-info').style.display = MODE === MODES.CAM ? '' : 'none';
|
||||
$('print-filament-head').style.display = MODE === MODES.FDM ? '' : 'none';
|
||||
$('print-filament-info').style.display = MODE === MODES.FDM ? '' : 'none';
|
||||
$('print-filename').value = filename;
|
||||
$('print-filesize').value = UTIL.comma(currentPrint.bytes);
|
||||
$('print-filament').value = Math.round(currentPrint.distance);
|
||||
|
|
@ -437,8 +443,10 @@
|
|||
octo_host = $('octo-host');
|
||||
octo_apik = $('octo-apik');
|
||||
if (MODE === MODES.CAM) {
|
||||
$('send-to-octohead').style.display = 'none';
|
||||
$('send-to-octoprint').style.display = 'none';
|
||||
} else {
|
||||
$('send-to-octohead').style.display = '';
|
||||
$('send-to-octoprint').style.display = '';
|
||||
}
|
||||
// hide octoprint when hard-coded in the url
|
||||
|
|
|
|||
|
|
@ -1133,6 +1133,7 @@
|
|||
|
||||
slider: $('slider'),
|
||||
sliderMax: $('slider-max'),
|
||||
sliderMin: $('slider-zero'),
|
||||
sliderLo: $('slider-lo'),
|
||||
sliderMid: $('slider-mid'),
|
||||
sliderHi: $('slider-hi'),
|
||||
|
|
@ -1415,9 +1416,11 @@
|
|||
// slider setup
|
||||
const slider = UI.sliderRange;
|
||||
const drag = { };
|
||||
|
||||
function pxToInt(txt) {
|
||||
return txt ? parseInt(txt.substring(0,txt.length-2)) : 0;
|
||||
}
|
||||
|
||||
function sliderUpdate() {
|
||||
let start = drag.top / drag.maxval;
|
||||
let end = (drag.top + drag.mid - 20) / drag.maxval;
|
||||
|
|
@ -1426,6 +1429,7 @@
|
|||
API.var.layer_lo = Math.round((1 - end) * API.var.layer_max);
|
||||
API.show.layer();
|
||||
}
|
||||
|
||||
function dragit(el, delta) {
|
||||
el.onmousedown = (ev) => {
|
||||
tracker.style.display = 'block';
|
||||
|
|
@ -1481,6 +1485,34 @@
|
|||
sliderUpdate();
|
||||
});
|
||||
|
||||
UI.sliderMin.onclick = () => {
|
||||
API.show.layer(0,0);
|
||||
}
|
||||
|
||||
UI.sliderMax.onclick = () => {
|
||||
API.show.layer(API.var.layer_max,0);
|
||||
}
|
||||
|
||||
UI.slider.onmouseover = (ev) => {
|
||||
API.event.emit('slider.label');
|
||||
};
|
||||
|
||||
UI.slider.onmouseleave = (ev) => {
|
||||
if (!ev.buttons) API.event.emit('slider.unlabel');
|
||||
};
|
||||
|
||||
API.event.on('slider.unlabel', (values) => {
|
||||
$('slider-hi-val').style.display = 'none';
|
||||
$('slider-lo-val').style.display = 'none';
|
||||
});
|
||||
|
||||
API.event.on('slider.label', (values) => {
|
||||
$('slider-hi-val').style.display = 'flex';
|
||||
$('slider-lo-val').style.display = 'flex';
|
||||
$('slider-hi-val').innerText = API.var.layer_hi;
|
||||
$('slider-lo-val').innerText = API.var.layer_lo;
|
||||
});
|
||||
|
||||
API.event.on('slider.set', (values) => {
|
||||
let height = slider.clientHeight;
|
||||
let maxval = height - 40;
|
||||
|
|
|
|||
|
|
@ -253,6 +253,7 @@
|
|||
view: {
|
||||
get: function() { return viewMode },
|
||||
set: setViewMode,
|
||||
update_slider: updateSlider,
|
||||
update_fields: updateFields,
|
||||
wireframe: toggleWireframe,
|
||||
snapshot: null
|
||||
|
|
@ -465,8 +466,11 @@
|
|||
}
|
||||
|
||||
function setVisibleLayer(h, l) {
|
||||
API.var.layer_hi = bound(h || API.var.layer_hi, 0, API.var.layer_max);
|
||||
API.var.layer_lo = bound(l || API.var.layer_lo, 0, API.var.layer_hi);
|
||||
h = h >= 0 ? h : API.var.layer_hi;
|
||||
l = l >= 0 ? l : API.var.layer_lo;
|
||||
API.var.layer_hi = bound(h, 0, API.var.layer_max);
|
||||
API.var.layer_lo = bound(l, 0, h);
|
||||
API.event.emit("slider.label");
|
||||
updateSlider();
|
||||
showSlices();
|
||||
}
|
||||
|
|
@ -526,6 +530,7 @@
|
|||
API.var.layer_max = UI.sliderMax.innerText = max;
|
||||
if (set || max < API.var.layer_hi) {
|
||||
API.var.layer_hi = API.var.layer_max;
|
||||
API.event.emit("slider.label");
|
||||
updateSlider();
|
||||
}
|
||||
}
|
||||
|
|
@ -561,6 +566,7 @@
|
|||
|
||||
layer = bound(layer, 0, API.var.layer_max);
|
||||
API.var.layer_hi = layer;
|
||||
API.event.emit("slider.label");
|
||||
|
||||
let print = UI.layerPrint.checked,
|
||||
moves = UI.layerMoves.checked,
|
||||
|
|
@ -1815,6 +1821,7 @@
|
|||
fetch("/api/grid_local")
|
||||
.then(r => r.json())
|
||||
.then(j => {
|
||||
let devc = 0;
|
||||
let bind = [];
|
||||
let html = ['<table>'];
|
||||
html.push(`<thead><tr><th>device</th><th>type</th><th>status</th><th></th></tr></thead>`);
|
||||
|
|
@ -1828,10 +1835,15 @@
|
|||
html.push(`<td>${r.state}</td>`);
|
||||
html.push(`<td><button id="${r.device.uuid}">admin</button></td>`);
|
||||
html.push(`</tr>`);
|
||||
devc++;
|
||||
}
|
||||
html.push(`</tbody>`);
|
||||
html.push(`</table>`);
|
||||
$('local-dev').innerHTML = html.join('');
|
||||
if (devc) {
|
||||
$('mod-local').innerHTML = html.join('');
|
||||
} else {
|
||||
$('mod-local').innerHTML = `<br><b>no local devices</b>`;
|
||||
}
|
||||
bind.forEach(rec => {
|
||||
$(rec.uuid).onclick = () => {
|
||||
window.open(`http://${rec.host}:${rec.port||4080}/`);
|
||||
|
|
|
|||
|
|
@ -1858,7 +1858,7 @@
|
|||
}
|
||||
|
||||
if (!stripComments) {
|
||||
append(`; Generated by Kiri:Moto ${exports.VERSION}`);
|
||||
append(`; Generated by Kiri:Moto ${KIRI.VERSION}`);
|
||||
append(`; ${new Date().toString()}`);
|
||||
filterEmit(["; Bed left:{left} right:{right} top:{top} bottom:{bottom}"], consts);
|
||||
append(`; Target: ${settings.filter[settings.mode]}`);
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@
|
|||
arr.forEach(function(line) { appendSub(line) });
|
||||
}
|
||||
|
||||
append(`; Generated by Kiri:Moto ${exports.VERSION}`);
|
||||
append(`; Generated by Kiri:Moto ${KIRI.VERSION}`);
|
||||
append(`; ${new Date().toString()}`);
|
||||
appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}");
|
||||
append(`; Target: ${settings.filter[settings.mode]}`);
|
||||
|
|
|
|||
|
|
@ -795,8 +795,7 @@
|
|||
$('print-filename').value = filename;
|
||||
$('print-layers').value = lines.length;
|
||||
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
|
||||
$('print-close').onclick = API.modal.hide;
|
||||
|
||||
|
||||
switch (device.deviceName) {
|
||||
case 'Anycubic.Photon':
|
||||
download.innerText += " .photon";
|
||||
|
|
|
|||
Loading…
Reference in a new issue