From 89d118f738a84c49a527adcce25a8561770e7cc1 Mon Sep 17 00:00:00 2001 From: Jose Luis Date: Fri, 20 Mar 2026 04:28:10 +0100 Subject: [PATCH] feat: keep placing mode active for multiple placements Selected gate type stays active after placing, allowing multiple gates of the same type without re-selecting. Right-click or Escape to cancel placing mode. Co-Authored-By: Claude Opus 4.6 --- js/events.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/events.js b/js/events.js index 557658b..14e507e 100644 --- a/js/events.js +++ b/js/events.js @@ -90,7 +90,7 @@ export function initEvents() { } state.gates.push(newGate); evaluateAll(); - state.placingGate = null; + // Keep placingGate active so user can place multiple — right-click to cancel return; } @@ -172,6 +172,13 @@ export function initEvents() { canvas.addEventListener('contextmenu', e => { e.preventDefault(); + + // Right-click cancels placing mode + if (state.placingGate) { + state.placingGate = null; + return; + } + const world = screenToWorld(e.offsetX, e.offsetY); const port = findPortAt(world.x, world.y); if (port && port.type === 'input') {