mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
Merge pull request #1840 from seltonmt012/fix/menu-focus-timer
fix(esx_menu_dialog, esx_menu_list): do not grab NUI focus after the menu closed
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
local Timeouts, OpenedMenus, MenuType = {}, {}, "dialog"
|
||||
local OpenedMenus, MenuType = {}, "dialog"
|
||||
|
||||
local function openMenu(namespace, name, data)
|
||||
for i = 1, #Timeouts, 1 do
|
||||
ESX.ClearTimeout(Timeouts[i])
|
||||
end
|
||||
|
||||
OpenedMenus[namespace .. "_" .. name] = true
|
||||
|
||||
SendNUIMessage({
|
||||
@@ -14,11 +10,11 @@ local function openMenu(namespace, name, data)
|
||||
data = data,
|
||||
})
|
||||
|
||||
local timeoutId = ESX.SetTimeout(200, function()
|
||||
SetNuiFocus(true, true)
|
||||
ESX.SetTimeout(200, function()
|
||||
if next(OpenedMenus) then
|
||||
SetNuiFocus(true, true)
|
||||
end
|
||||
end)
|
||||
|
||||
table.insert(Timeouts, timeoutId)
|
||||
end
|
||||
|
||||
local function closeMenu(namespace, name)
|
||||
|
||||
@@ -12,7 +12,9 @@ CreateThread(function()
|
||||
data = data,
|
||||
})
|
||||
SetTimeout(200, function()
|
||||
SetNuiFocus(true, true)
|
||||
if next(OpenedMenus) then
|
||||
SetNuiFocus(true, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user