From 7d8f64d17cd1822fef0016d386966b6d27b1954f Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 2 Mar 2026 20:24:09 -0800 Subject: [PATCH] fix: make pencil tool temporary, return to selector on ESC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drawing tools (pencil, rect, circle, line) now auto-clear after one stroke, returning to the default selector tool. ESC clears any active whiteboard tool. Switching to another toolbar tool also clears the active whiteboard tool. This fixes the resize issue — when a whiteboard tool was stuck active, canvasContent had pointer-events:none which blocked all shape interactions including resize handles. Co-Authored-By: Claude Opus 4.6 --- website/canvas.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/website/canvas.html b/website/canvas.html index e4045e3..a29a08c 100644 --- a/website/canvas.html +++ b/website/canvas.html @@ -3215,6 +3215,7 @@ let ghostEl = null; function setPendingTool(tagName, props = {}) { + if (wbTool) setWbTool(null); // clear whiteboard tool when switching pendingTool = { tagName, props }; canvas.style.cursor = "crosshair"; @@ -3270,10 +3271,11 @@ } }); - // ESC clears pending tool + // ESC returns to default selector tool document.addEventListener("keydown", (e) => { - if (e.key === "Escape" && pendingTool) { - clearPendingTool(); + if (e.key === "Escape") { + if (wbTool) setWbTool(null); + if (pendingTool) clearPendingTool(); } }); @@ -3561,6 +3563,7 @@ const newArrowBtn = document.getElementById("new-arrow"); newArrowBtn.addEventListener("click", () => { + if (wbTool) setWbTool(null); // clear whiteboard tool connectMode = !connectMode; newArrowBtn.classList.toggle("active", connectMode); canvas.classList.toggle("connect-mode", connectMode); @@ -3770,6 +3773,11 @@ wbPreviewEl = null; wbCurrentPath = []; + + // Drawing tools are temporary — return to selector after one stroke + if (wbTool && wbTool !== "eraser") { + setWbTool(null); + } }); // Eraser: click on existing SVG strokes to delete them + remove from Automerge