mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-05 03:33:23 +01:00
34 lines
1013 B
JavaScript
34 lines
1013 B
JavaScript
var keyboardShortcutsEnabled = true;
|
|
|
|
function initKeyboard() {
|
|
|
|
$(document).keypress(function(event) {
|
|
|
|
if (!keyboardShortcutsEnabled) return;
|
|
|
|
var ch = String.fromCharCode(event.which);
|
|
|
|
switch (ch) {
|
|
case 'c': clearDoodle(); break;
|
|
case 'n': clearDoodle(); break;
|
|
case 'p': print(); break;
|
|
case 'u': oopsUndo(); break;
|
|
case 'e': settingsWindow.downloadGcode(); break;
|
|
case 'q': stopPrint(); break;
|
|
case ',': openSettingsWindow(); break;
|
|
case 'C': drawCircle(250,180,80,64); break; //x,y,r,res
|
|
case 'T': drawCircle(250,180,80,3); break; //triangle
|
|
case 'X': drawCircle(250,180,80,6); break; //hexagon
|
|
case 'h': previewUp(true); break;
|
|
case 'H': previewDown(true); break;
|
|
case 's': saveSketch(); break;
|
|
case 'L': nextDoodle(); break;
|
|
case 'l': prevDoodle(); break;
|
|
case '[': previewTwistLeft(); break;
|
|
case ']': previewTwistRight(); break;
|
|
case '\'': resetTwist(); break;
|
|
default: console.log("Key: '" + ch + "' (" + event.which + ")");
|
|
}
|
|
})
|
|
|
|
} |