Skip to content

Commit

Permalink
Fix Focus #167
Browse files Browse the repository at this point in the history
  • Loading branch information
Gannon001 committed May 9, 2019
1 parent 5e84496 commit 8514d39
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions resources/gcphone/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local USE_RTC = false
local useMouse = false
local ignoreFocus = false
local takePhoto = false
local lastFrameIsOpen = false
local hasFocus = false

local PhoneInCall = {}
local currentPlaySound = false
Expand Down Expand Up @@ -89,17 +89,21 @@ Citizen.CreateThread(function()
for _, value in ipairs(KeyToucheCloseEvent) do
if IsControlJustPressed(1, value.code) then
SendNUIMessage({keyUp = value.event})
print(value.event)
end
end
local nuiFocus = useMouse and not ignoreFocus
if nuiFocus == true then
if hasFocus == true and ignoreFocus == true then
SetNuiFocus(false, false)
hasFocus = false
elseif nuiFocus == true then
SetNuiFocus(nuiFocus, nuiFocus)
lastFrameIsOpen = true
hasFocus = true
end
else
if lastFrameIsOpen == true then
if hasFocus == true then
SetNuiFocus(false, false)
lastFrameIsOpen = false
hasFocus = false
end
end
end
Expand Down

0 comments on commit 8514d39

Please sign in to comment.