equate onenter and onblur

This commit is contained in:
Stewart Allen 2021-04-07 22:14:53 -04:00
commit ceb05f683e
2 changed files with 8 additions and 3 deletions

View file

@ -2143,7 +2143,7 @@
$('rot_x'), selectionRotate, $('rot_x'), selectionRotate,
$('rot_y'), selectionRotate, $('rot_y'), selectionRotate,
$('rot_z'), selectionRotate $('rot_z'), selectionRotate
]); ], true);
$('lab-axis').onclick = () => { $('lab-axis').onclick = () => {
UI.lockX.checked = UI.lockX.checked =

View file

@ -229,14 +229,19 @@
} }
} }
function onEnterKey(el, fn) { function onEnterKey(el, fn, onblur) {
if (Array.isArray(el)) { if (Array.isArray(el)) {
for (let i=0; i<el.length; i += 2) onEnterKey(el[i], el[i+1]); for (let i=0; i<el.length; i += 2) onEnterKey(el[i], el[i+1], fn);
return; return;
} }
addEventListener(el, 'keyup', function(event) { addEventListener(el, 'keyup', function(event) {
if (event.keyCode === 13) fn(event); if (event.keyCode === 13) fn(event);
}); });
if (onblur) {
addEventListener(el, 'blur', function(event) {
fn(event);
});
}
} }
function addLight(x,y,z,i) { function addLight(x,y,z,i) {