move document events out of whiteboard.js to main.js

This commit is contained in:
raphael
2019-02-22 13:14:34 +01:00
parent 350fda5b6f
commit 74b1f10eaf
2 changed files with 59 additions and 51 deletions

View File

@@ -55,6 +55,34 @@ $(document).ready(function () {
Whiteboard actions
/----------------*/
//Handle key actions
$(document).on("keydown", function (e) {
if (e.which == 17) {
whiteboard.pressedKeys["strg"] = true;
} else if (e.which == 90) { //z key
if (whiteboard.pressedKeys["strg"] && !whiteboard.pressedKeys["z"]) {
whiteboard.undoWhiteboardClick();
}
whiteboard.pressedKeys["z"] = true;
} else if (e.which == 16) {
whiteboard.pressedKeys["shift"] = true; //Used for straight lines...
} else if (e.which == 27) { //Esc
whiteboard.escKeyAction();
} else if (e.which == 46) { //Remove / Entf
whiteboard.entfKeyAction();
}
//console.log(e.which);
});
$(document).on("keyup", function (e) {
if (e.which == 17) {
whiteboard.pressedKeys["strg"] = false;
} else if (e.which == 90) {
whiteboard.pressedKeys["z"] = false;
} else if (e.which == 16) {
whiteboard.pressedKeys["shift"] = false;
}
});
// whiteboard clear button
$("#whiteboardTrashBtn").click(function () {
$("#whiteboardTrashBtnConfirm").show().focus();