Skip to content
Snippets Groups Projects
Commit 3d5788e7 authored by Laurel Williams's avatar Laurel Williams
Browse files

Fix space key for Apple keyboards

parent 2ff1a8b4
Branches
No related tags found
No related merge requests found
......@@ -131,6 +131,10 @@ $( "#textfield" ).keydown(function(event) {
else if (event.key.startsWith('Arrow') && document.getElementById('textfield').value === "") { // arrow keys
socket.emit('functionality', event.key);
}
else if (event.keyCode === 32 && document.getElementById('textfield').value === '') { // space
socket.emit('functionality', 'Space');
document.getElementById('textfield').value = '';
}
});
//Purpose: Uses interact.js library to enable keys to move around
......
......@@ -148,14 +148,14 @@ io.on('connection', function(socket) {
case 'ArrowRight':
robot.keyTap('right');
break;
case 'Space':
robot.keyTap('space');
break;
}
});
socket.on('text', function(text) {
console.log('Typing ' + text);
if (text === ' ') {
robot.keyTap('space');
}
robot.typeString(text);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment