prevent missing options error

This commit is contained in:
Stewart Allen 2020-04-22 10:01:16 -04:00
commit 08fbc8c91f
2 changed files with 14 additions and 13 deletions

View file

@ -379,12 +379,13 @@ var gs_moto_ui = exports;
} }
function newInputField(label, options) { function newInputField(label, options) {
let row = newDiv(options), let opt = options || {},
hide = options && options.hide, row = newDiv(opt),
size = options ? options.size || 5 : 5, hide = opt && opt.hide,
height = options ? options.height : 0, size = opt ? opt.size || 5 : 5,
height = opt ? opt.height : 0,
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'), ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
action = options.action || inputAction; action = opt.action || inputAction;
row.appendChild(newLabel(label)); row.appendChild(newLabel(label));
row.appendChild(ip); row.appendChild(ip);
@ -402,12 +403,12 @@ var gs_moto_ui = exports;
} }
ip.setAttribute("type", "text"); ip.setAttribute("type", "text");
row.style.display = hide ? 'none' : ''; row.style.display = hide ? 'none' : '';
if (options) { if (opt) {
if (options.disabled) ip.setAttribute("disabled", "true"); if (opt.disabled) ip.setAttribute("disabled", "true");
if (options.title) row.setAttribute("title", options.title); if (opt.title) row.setAttribute("title", opt.title);
if (options.convert) ip.convert = options.convert.bind(ip); if (opt.convert) ip.convert = opt.convert.bind(ip);
if (options.bound) ip.bound = options.bound; if (opt.bound) ip.bound = opt.bound;
if (options.action) action = options.action; if (opt.action) action = opt.action;
} }
ip.addEventListener('focus', function(event) { ip.addEventListener('focus', function(event) {
hidePop(); hidePop();
@ -416,7 +417,7 @@ var gs_moto_ui = exports;
ip.addEventListener('keydown', function(event) { ip.addEventListener('keydown', function(event) {
let key = event.key; let key = event.key;
if ( if (
options.text || opt.text ||
(key >= '0' && key <= '9') || (key >= '0' && key <= '9') ||
key === '.' || key === '.' ||
key === '-' || key === '-' ||

View file

@ -15,7 +15,7 @@
# FDM # FDM
* `B` check for support / brim intersections on first layer * `B` check for support / brim intersections on first layer
* `F` rectilinear infill * `F` add separate fill speed control
* `F` manual support addition / control * `F` manual support addition / control
* `F` polishing and other non-planar work * `F` polishing and other non-planar work
* `F` gradient infill https://www.youtube.com/watch?v=hq53gsYREHU&feature=emb_logo * `F` gradient infill https://www.youtube.com/watch?v=hq53gsYREHU&feature=emb_logo