refactor(web/radial): disable nui focus when closing with x button

This commit is contained in:
Luke
2023-02-10 18:17:30 +01:00
parent 7acad823b8
commit 71885f5831
2 changed files with 16 additions and 1 deletions

View File

@@ -97,6 +97,17 @@ RegisterNUICallback('radialBack', function(_, cb)
})
end)
RegisterNUICallback('radialClose', function(_, cb)
cb(1)
if not isOpen then return end
SetNuiFocus(false, false)
isOpen = false
currentRadial = nil
end)
lib.addKeybind({
name = 'ox_lib-radial',
description = 'Open radial menu',

View File

@@ -124,7 +124,11 @@ const RadialMenu: React.FC = () => {
<g
transform={`translate(175, 175)`}
onClick={() => {
menu.sub ? fetchNui('radialBack') : setVisible(false);
if (menu.sub) fetchNui('radialBack');
else {
setVisible(false);
fetchNui('radialClose');
}
}}
>
<circle r={30} className={classes.centerCircle} />