add show rulers option to preference menu

This commit is contained in:
Stewart Allen 2020-10-29 11:34:48 -04:00
commit 0f8e29c20b
6 changed files with 31 additions and 11 deletions

View file

@ -605,6 +605,7 @@
thinRender: false,
reverseZoom: true,
showOrigin: false,
showRulers: false,
freeLayout: true,
autoLayout: true,
alignTop: true,

View file

@ -91,6 +91,7 @@
control.expert = UI.expert.checked;
control.hoverPop = UI.hoverPop.checked;
control.showOrigin = UI.showOrigin.checked;
control.showRulers = UI.showRulers.checked;
control.autoLayout = UI.autoLayout.checked;
control.freeLayout = UI.freeLayout.checked;
control.alignTop = UI.alignTop.checked;
@ -1330,23 +1331,26 @@
(UI.gcodePost = UC.newGCode(LANG.dv_foot_s, {title:LANG.dv_foot_l, modes:GCODE, area:gcode})).button
], {modes:GCODE, class:"ext-buttons f-row"}),
layout: UC.newGroup(LANG.op_menu, $('prefs-gen'), {inline: true}),
lprefs: UC.newGroup(LANG.op_menu, $('prefs-gen'), {inline: true}),
expert: UC.newBoolean(LANG.op_xprt_s, booleanSave, {title:LANG.op_xprt_l}),
hoverPop: UC.newBoolean(LANG.op_hopo_s, booleanSave, {title:LANG.op_hopo_l}),
dark: UC.newBoolean(LANG.op_dark_s, booleanSave, {title:LANG.op_dark_l}),
showOrigin: UC.newBoolean(LANG.op_show_s, booleanSave, {title:LANG.op_show_l, modes:GCODE}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l, modes:ALL}),
thinRender: UC.newBoolean(LANG.op_thin_s, booleanSave, {title:LANG.op_thin_l, modes:ALL}),
layout: UC.newGroup(LANG.lo_menu, $('prefs-lay'), {inline: true}),
showOrigin: UC.newBoolean(LANG.op_shor_s, booleanSave, {title:LANG.op_shor_l, modes:GCODE}),
showRulers: UC.newBoolean(LANG.op_shru_s, booleanSave, {title:LANG.op_shru_l, modes:GCODE}),
alignTop: UC.newBoolean(LANG.op_alig_s, booleanSave, {title:LANG.op_alig_l, modes:CAM}),
autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}),
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l, modes:ALL}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l, modes:ALL}),
thinRender: UC.newBoolean(LANG.op_thin_s, booleanSave, {title:LANG.op_thin_l, modes:ALL}),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM, action:unitsSave}, "units"),
prefadd: UC.checkpoint(),
export: UC.newGroup(LANG.xp_menu, $('prefs-out'), {inline: true}),
exportOcto: UC.newBoolean(`OctoPrint`, booleanSave),
exportGhost: UC.newBoolean(`Grid:Host`, booleanSave),
exportLocal: UC.newBoolean(`Grid:Local`, booleanSave),
prefadd: UC.checkpoint($('prefs-add')),
process: UC.newGroup(LANG.sl_menu, $('settings'), {modes:FDM_LASER}),
sliceHeight: UC.newInput(LANG.sl_lahi_s, {title:LANG.sl_lahi_l, convert:UC.toFloat, modes:FDM}),
@ -1872,6 +1876,7 @@
// restore UI state from settings
UI.showOrigin.checked = control.showOrigin;
UI.showRulers.checked = control.showRulers;
UI.freeLayout.checked = control.freeLayout;
UI.autoLayout.checked = control.autoLayout;
UI.alignTop.checked = control.alignTop;

View file

@ -992,6 +992,7 @@
platform.update_bounds();
let dev = settings.device;
let proc = settings.process;
let ruler = settings.controller.showRulers;
let x = 0;
let y = 0;
let z = 0;
@ -1020,6 +1021,7 @@
y = -camStock.position.y;
}
settings.origin = {x, y, z};
SPACE.platform.setRulers(ruler, ruler, proc.outputOriginCenter);
if (settings.controller.showOrigin && MODE !== MODES.SLA) {
SPACE.platform.setOrigin(x,y,z);
} else {
@ -1047,7 +1049,9 @@
depth = parseInt(dev.bedDepth),
height = parseFloat(dev.bedHeight)
);
let ctrl = settings.controller,
let proc = settings.process,
ctrl = settings.controller,
ruler = ctrl.showRulers,
unitMM = ctrl.units === 'mm',
gridMajor = unitMM ? 25 : 25.4,
gridMinor = unitMM ? 5 : 25.4 / 10;
@ -1062,6 +1066,7 @@
SPACE.setSkyColor(0xffffff);
DOC.body.classList.remove('dark');
}
SPACE.platform.setRulers(ruler, ruler, proc.outputOriginCenter);
SPACE.platform.setGZOff(height/2 - 0.1);
platform.update_origin();
SPACE.scene.freeze(frozen);

View file

@ -152,8 +152,8 @@
letHoverPop = bool;
}
function checkpoint() {
return { addTo, lastDiv, lastGroup, groupName };
function checkpoint(at) {
return { addTo: at || addTo, lastDiv: at || lastDiv, lastGroup, groupName };
}
function restore(opt) {

View file

@ -306,7 +306,12 @@
<div id="mod-prefs" class="mdialog f-row">
<div id="prefs-gen" class="f-col"></div>
<div class="t-pad2"></div>
<div id="prefs-lay" class="f-col"></div>
<div class="t-pad2"></div>
<div id="prefs-out" class="f-col"></div>
<div class="t-pad2"></div>
<div id="prefs-add" class="f-col"></div>
<div class="t-pad2"></div>
</div>
<div id="mod-local" class="mdialog f-col"></div>
<div id="mod-print" class="mdialog f-col"></div>

View file

@ -121,8 +121,10 @@ kiri.lang['en-us'] = {
op_dark_l: "dark mode interface",
op_comp_s: "compact ui",
op_comp_l: "compact user interface\nbetter for small screens\nand tablets",
op_show_s: "show origin",
op_show_l: "show device or process origin",
op_shor_s: "show origin",
op_shor_l: "show device or process origin",
op_shru_s: "show rulers",
op_shru_l: "show axes rulers\non major gridlines",
op_alig_s: "align top",
op_alig_l: "align parts to the\ntallest part when\nno stock is set",
op_auto_s: "auto layout",
@ -136,7 +138,9 @@ kiri.lang['en-us'] = {
op_unit_s: "units",
op_unit_l: "workspace units affects\nspeeds and distances",
xp_menu: "export",
lo_menu: "layout",
xp_menu: "exports",
// LAYERS pop-menu
la_menu: "layers",