mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
feat(web/menu): visibility handling
This commit is contained in:
@@ -36,21 +36,19 @@ end)
|
|||||||
|
|
||||||
RegisterNUICallback('changeSelected', function(data, cb)
|
RegisterNUICallback('changeSelected', function(data, cb)
|
||||||
cb(1)
|
cb(1)
|
||||||
if registeredMenus[openMenu].onChange then
|
if not registeredMenus[openMenu].onChange then return end
|
||||||
local selected = data
|
local selected = data
|
||||||
if type(selected) == 'number' then
|
if type(selected) == 'number' then
|
||||||
registeredMenus[openMenu].onChange(selected)
|
registeredMenus[openMenu].onChange(selected)
|
||||||
else
|
else
|
||||||
registeredMenus[openMenu].onChange(selected[1], selected[2])
|
registeredMenus[openMenu].onChange(selected[1], selected[2])
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterCommand('testMenu', function()
|
RegisterCommand('testMenu', function()
|
||||||
lib.registerMenu({
|
lib.registerMenu({
|
||||||
id = 'epic_menu',
|
id = 'epic_menu',
|
||||||
title = 'Nice menu',
|
title = 'Nice menu',
|
||||||
position = 'top-right',
|
|
||||||
onChange = function(selected, scrollIndex)
|
onChange = function(selected, scrollIndex)
|
||||||
print(selected, scrollIndex)
|
print(selected, scrollIndex)
|
||||||
end,
|
end,
|
||||||
@@ -60,6 +58,17 @@ RegisterCommand('testMenu', function()
|
|||||||
}
|
}
|
||||||
}, function(selected, scrollIndex)
|
}, function(selected, scrollIndex)
|
||||||
print(selected, scrollIndex)
|
print(selected, scrollIndex)
|
||||||
|
lib.registerMenu({
|
||||||
|
id = 'more_epic_menu',
|
||||||
|
title = 'Nicer menu',
|
||||||
|
position = 'top-right',
|
||||||
|
options = {
|
||||||
|
{label = 'Extra nice option'},
|
||||||
|
{label = 'Giga nice option'},
|
||||||
|
{label = 'Omega nice option'},
|
||||||
|
}
|
||||||
|
}, function() end)
|
||||||
|
lib.showMenu('more_epic_menu')
|
||||||
end)
|
end)
|
||||||
lib.showMenu('epic_menu')
|
lib.showMenu('epic_menu')
|
||||||
end)
|
end)
|
||||||
@@ -122,6 +122,7 @@ const ListMenu: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{visible && (
|
||||||
<Box
|
<Box
|
||||||
position="absolute"
|
position="absolute"
|
||||||
pointerEvents="none"
|
pointerEvents="none"
|
||||||
@@ -161,6 +162,7 @@ const ListMenu: React.FC = () => {
|
|||||||
</FocusTrap>
|
</FocusTrap>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user