From 15edf657ee1cb7cd351c5321164b494f2c8651e7 Mon Sep 17 00:00:00 2001 From: Axel Meyer Date: Fri, 15 May 2026 21:40:03 +0200 Subject: [PATCH] refactor(selection): remove prev_click_down, use input.was_action_released (P.3.10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Behavior identical. lib-core.input dep bump 0.3.0 → 0.4.0. Resolves audit I1 (RTS-Tech-Demo-Audit 2026-05-14). --- init.lua | 14 +++++--------- manifest.lib | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 1b16968..356cf0a 100644 --- a/init.lua +++ b/init.lua @@ -8,6 +8,9 @@ -- action-names (mod_add, mod_toggle). AABB-Hit-Test (last-registered-wins). -- Render: alpha-tinted draw_rect helpers (kein Outline). -- +-- P.3.10 patch (2026-05-15): prev_click_down workaround removed. +-- Uses lib-core.input v0.4.0 was_action_released. Behaviorally identical. +-- -- DEPRECATED-MVPs siehe Spec §7 + inline-comments unten. -- ===================================================================== @@ -28,7 +31,6 @@ local press_y = 0 local cur_x = 0 local cur_y = 0 local drag_threshold = 4 -- px -local prev_click_down = false -- release-edge detection -- Bindings. local click_action = nil @@ -308,15 +310,11 @@ end -- Per-Frame function M.update(dt) - -- 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 released = input.was_action_released(click_action) + local mx, my = engine.input.get_mouse_pos() if drag_state == "idle" then @@ -380,8 +378,6 @@ function M.render_highlights() end end --- DEPRECATED-MVP: was_action_released in lib-core.input (currently tracked internally --- via prev_click_down — promote to input-lib when 2nd consumer needs it) -- DEPRECATED-MVP: pixel-perfect click hit-test (needs sprite-API + opacity-mask) -- DEPRECATED-MVP: register(aabb_fn, z) z-order disambiguator -- DEPRECATED-MVP: on_changed(fn) observer-callback (polling-API sufficient for RTS-MVP) diff --git a/manifest.lib b/manifest.lib index 59e36f1..f9e35d4 100644 --- a/manifest.lib +++ b/manifest.lib @@ -1 +1 @@ -{"id":"lib-core.selection","version":"0.1.0","api_min":"0.1","deps":[{"id":"lib-core.input","version":"0.3.0"},{"id":"lib-core.camera","version":"0.3.0"}]} \ No newline at end of file +{"id":"lib-core.selection","version":"0.1.0","api_min":"0.1","deps":[{"id":"lib-core.input","version":"0.4.0"},{"id":"lib-core.camera","version":"0.3.0"}]} \ No newline at end of file