From bd43f2659da9c4a50ac9ad1a50fc429c836816b5 Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Thu, 14 May 2026 15:06:46 +0200 Subject: [PATCH] fix(selection): sync prev_click_down before early returns Previously, set_enabled(false) caused prev_click_down to drift, so a click that spanned a disable/enable window would be silently dropped. Move release-edge sync above early returns; handle click_action==nil guard inline so is_action_down isn't called with nil. --- init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 151bcfa..1b16968 100644 --- a/init.lua +++ b/init.lua @@ -308,14 +308,15 @@ end -- Per-Frame function M.update(dt) - if not enabled_flag then return end - if click_action == nil then return end - - -- Release-edge detection (lib-core.input has no was_action_released). - local cur_down = input.is_action_down(click_action) + -- Release-edge detection must sync EVERY frame (even when disabled or unbound) + -- so prev_click_down doesn't drift across enable/disable boundaries. + local cur_down = (click_action ~= nil) and input.is_action_down(click_action) or false local released = (prev_click_down and not cur_down) prev_click_down = cur_down + if not enabled_flag then return end + if click_action == nil then return end + local mx, my = engine.input.get_mouse_pos() if drag_state == "idle" then