www.spaceplanner.app

Web client to the spaceplanner API
git clone git://jacobedwards.org/www.spaceplanner.app
Log | Files | Refs

commit 940bff970f79ab15ce4b3055c0ca689bb6f6bee9
parent 2c673cf589f04e88f85dd14fe4690fa398126cb8
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sat, 21 Sep 2024 16:11:00 -0700

Dispatch the escape event when clicking canvas

This way to escape a menu, etc. you can just click the canvas. This
is the behavior I would expect.

Diffstat:
Mfiles/floorplans/floorplan/main.js | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/files/floorplans/floorplan/main.js b/files/floorplans/floorplan/main.js @@ -293,14 +293,12 @@ function selectionHandler(event, editor) { } editor.draw.select() + escape() } function controlKeyHandler(ev, editor) { if (ev.type === "keydown" && ev.key === "Escape") { - document.body.querySelectorAll(".escapable").forEach(function(e) { - console.debug("Escape", e) - e.dispatchEvent(escapeEvent) - }) + escape() } } @@ -1088,4 +1086,11 @@ function handled(event) { event.preventDefault() } +function escape() { + document.body.querySelectorAll(".escapable").forEach(function(e) { + console.debug("Escape", e) + e.dispatchEvent(escapeEvent) + }) +} + window.onload = init