From f5c56af2d2afd16ef44d602006d414d5c468007d Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 30 Jun 2021 18:23:32 -0600 Subject: [PATCH] Clear image after switching tools to prevent accidental drawing --- js/drawtools.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/drawtools.js b/js/drawtools.js index 97e9f2e..518760e 100644 --- a/js/drawtools.js +++ b/js/drawtools.js @@ -99,7 +99,7 @@ $("#page-canvas-container").on("click", ".page-canvas", function (evt) { }); $("#page-canvas-container").on("click", ".page-canvas.active", function (evt) { - if (typeof activeDrawImage == "undefined") { + if (typeof activeDrawImage == "undefined" || activeDrawImage == null) { return; } var canvas = $(this)[0]; @@ -137,6 +137,7 @@ function disableGuideBox() { var context = $("#placementguidebox")[0].getContext('2d'); context.clearRect(0, 0, $("#placementguidebox")[0].width, $("#placementguidebox")[0].height); + activeDrawImage = null; } $("#page-canvas-container").on("mousemove", function (evt) {