Skip to content
Snippets Groups Projects
Commit 12a47154 authored by Han DongGyun ULAC154's avatar Han DongGyun ULAC154
Browse files

add keyboard shortcuts

parent d10660d0
Branches
No related tags found
No related merge requests found
...@@ -71,12 +71,16 @@ function slide_drawing_init(paneId) { ...@@ -71,12 +71,16 @@ function slide_drawing_init(paneId) {
canvas.isDrawingMode = false canvas.isDrawingMode = false
} }
new Array("red", "blue", "black").forEach(col => { function initBrush(col) {
document.getElementById("fabric-" + col).onclick = function () {
canvas.isDrawingMode = true canvas.isDrawingMode = true
canvas.freeDrawingBrush.color = col canvas.freeDrawingBrush.color = col
canvas.freeDrawingBrush.width = 3 canvas.freeDrawingBrush.width = 3
} }
new Array("red", "blue", "black").forEach(col => {
document.getElementById("fabric-" + col).addEventListener("click", (e) => {
initBrush(col);
})
}) })
document.getElementById("fabric-delete").onclick = function () { document.getElementById("fabric-delete").onclick = function () {
...@@ -88,4 +92,20 @@ function slide_drawing_init(paneId) { ...@@ -88,4 +92,20 @@ function slide_drawing_init(paneId) {
document.getElementById("fabric-clear").onclick = function () { document.getElementById("fabric-clear").onclick = function () {
canvas.clear() canvas.clear()
} }
document.addEventListener('keydown', (e) => {
switch (e.key) {
case "ArrowLeft":
case "ArrowRight":
case "c":
lowerCanvas();
canvas.clear();
break;
case "r":
raiseCanvas();
initBrush("red");
break;
}
});
} }
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<base target="_blank" /> <base target="_blank" />
<meta charset="utf-8"> <meta charset="utf-8">
...@@ -98,8 +99,14 @@ MathJax.Hub.Config({ ...@@ -98,8 +99,14 @@ MathJax.Hub.Config({
function initialisePage() { function initialisePage() {
console.log("Creating TOC") console.log("Creating TOC")
createTOC() createTOC()
document.addEventListener('keydown', (e) => {
if (e.key == "s") {
startPresentation();
}
});
} }
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment