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.
This commit is contained in:
11
init.lua
11
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
|
||||
|
||||
Reference in New Issue
Block a user