From 08f30ddb0e8b8419689342605b83cad528bd8fc2 Mon Sep 17 00:00:00 2001 From: Helwor Date: Sat, 6 Jun 2026 17:49:38 +0200 Subject: [PATCH 1/2] Better reactivity On the demand of Godde --- LuaUI/Widgets/gui_chili_gesture_menu.lua | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/LuaUI/Widgets/gui_chili_gesture_menu.lua b/LuaUI/Widgets/gui_chili_gesture_menu.lua index 92a21aa77c..588d5ba547 100644 --- a/LuaUI/Widgets/gui_chili_gesture_menu.lua +++ b/LuaUI/Widgets/gui_chili_gesture_menu.lua @@ -15,7 +15,7 @@ function widget:GetInfo() handler = true, } end - +Spring.Echo('test') include("keysym.lua") VFS.Include("LuaRules/Configs/customcmds.h.lua") ------------------------------------------------- @@ -226,9 +226,8 @@ local function CanInitialQueue() end -function widget:Update(t) +function widget:MouseMove(mx, my) if not menu or KEYBOARD_ONLY or mouselessOpen then return end - local mx, my = Spring.GetMouseState() ProcessMove(mx,my) if hold_pos then local dx = mx - hold_pos[1] @@ -240,6 +239,17 @@ function widget:Update(t) end end + +function widget:Update(t) + if not menu or KEYBOARD_ONLY or mouselessOpen then return end + if hold_pos then + if osclock() - menu_start > IDLE_THRESHOLD then + menu_invisible = false + hold_pos = nil + end + end +end + local lx = 0 local ly = 0 @@ -391,10 +401,10 @@ function EndMenu(ok) level = level + 1 -- save level levels[level] = {menu_selected, menu_selected.angle+180} end - if osclock() - menu_start > level * 0.25 then -- if speed was slower than 250ms per level, flash the gesture + if osclock() - menu_start > level * 0.25 then -- if speed was slower than 250ms per level, flash the gesture menu_flash = {origin[1], origin[2], osclock()} end - Spring.SetActiveCommand(cmdid, 1, left, right, alt, ctrl, meta, shift) -- FIXME set only when you close menu + Spring.SetActiveCommand(cmdid, 1, left, right, alt, ctrl, meta, shift) -- FIXME set only when you close menu end end origin = nil @@ -619,7 +629,7 @@ local function DrawMenuItem(item, x,y, size, alpha, displayLabel, angle, cmdDesc if displayLabel == nil then displayLabel = true end if item then local ud = UnitDefNames[item.unit] - if (ud) then + if (ud) then if (displayLabel and item.label) then glColor(1,1,1,alpha) local wid = glGetTextWidth(item.label)*12 From d07204c131a4fd9379fcbaa5df2df396bdef742b Mon Sep 17 00:00:00 2001 From: Helwor Date: Tue, 16 Jun 2026 07:20:44 +0200 Subject: [PATCH 2/2] remove echo --- LuaUI/Widgets/gui_chili_gesture_menu.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaUI/Widgets/gui_chili_gesture_menu.lua b/LuaUI/Widgets/gui_chili_gesture_menu.lua index 588d5ba547..1463c98f64 100644 --- a/LuaUI/Widgets/gui_chili_gesture_menu.lua +++ b/LuaUI/Widgets/gui_chili_gesture_menu.lua @@ -15,7 +15,7 @@ function widget:GetInfo() handler = true, } end -Spring.Echo('test') + include("keysym.lua") VFS.Include("LuaRules/Configs/customcmds.h.lua") -------------------------------------------------