From ea0e9f84527f108ac7d886b11a7b37afd0c09448 Mon Sep 17 00:00:00 2001 From: raphael Date: Mon, 4 May 2020 14:22:08 +0200 Subject: [PATCH] draw lines on shift press when pen is selected --- src/js/main.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/js/main.js b/src/js/main.js index ed2bbf7..41dd682 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -91,16 +91,33 @@ function main() { Whiteboard actions /----------------*/ + var tempLineTool = false; + var strgPressed = false; //Handle key actions $(document).on("keydown", function (e) { if (e.which == 16) { - whiteboard.pressedKeys["shift"] = true; //Used for straight lines... + if(whiteboard.tool=="pen" && !strgPressed) { + tempLineTool = true; + whiteboard.ownCursor.hide(); + shortcutFunctions.setTool_line(); + } else { + whiteboard.pressedKeys["shift"] = true; //Used for straight lines... + } + } else if (e.which == 17) { + strgPressed = true; } //console.log(e.which); }); $(document).on("keyup", function (e) { if (e.which == 16) { + if(tempLineTool) { + tempLineTool = false; + shortcutFunctions.setTool_pen(); + whiteboard.ownCursor.show(); + } whiteboard.pressedKeys["shift"] = false; + } else if (e.which == 17) { + strgPressed = false; } });