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