From 3f7686a6140160b147c3925af1fdc5d159857f54 Mon Sep 17 00:00:00 2001 From: jlamoreaux Date: Wed, 29 May 2024 17:34:59 -0400 Subject: [PATCH] shortcut to clear out the canvas --- js/script.js | 3 +++ js/utils.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/js/script.js b/js/script.js index 1e75475..6580a19 100644 --- a/js/script.js +++ b/js/script.js @@ -796,6 +796,9 @@ function Add_EventHandlers_To_Document() { Delete_Selected(); } + if(e.code === "KeyK"){ + Clear_Paint_From_Canvas() + } if(e.code === "Escape") { Remove_Selection(); diff --git a/js/utils.js b/js/utils.js index 229edc6..c4d272d 100644 --- a/js/utils.js +++ b/js/utils.js @@ -163,3 +163,11 @@ function Get_Canvas_Pixels() }) return canvasPixels; } + +function Clear_Paint_From_Canvas() +{ + let canvasCells = document.querySelectorAll(".canvasCell"); + canvasCells.forEach(function(cell){ + cell.style.backgroundColor = CANVAS_INIT_COLOR; + }) +} \ No newline at end of file