Skip to content

Commit

Permalink
Fix Console UI unfocusing on click in certain themes (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqikerz authored May 17, 2024
1 parent 28c5829 commit ac20ad8
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 20 deletions.
12 changes: 10 additions & 2 deletions MainModule/Client/UI/Aero/Console.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,13 @@ return function(data, env)
end
end

local function isInConsoleBounds(pos)
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end

text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
Expand All @@ -838,9 +845,10 @@ return function(data, env)
end)
client.Remote.Send('ProcessCommand',text.Text)
end
close()
elseif not isInConsoleBounds(player:GetMouse()) then
close()
end

close()
end)

text.Changed:Connect(function(c)
Expand Down
19 changes: 14 additions & 5 deletions MainModule/Client/UI/Default/Console.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ return function(data, env)
if env then
setfenv(1, env)
end

local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local UI = client.UI
local Remote = client.Remote
local Variables = client.Variables
Expand Down Expand Up @@ -706,14 +707,22 @@ return function(data, env)
opened = true
end

local function isInConsoleBounds(pos)
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end

text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if string.len(text.Text) > 1 then
Remote.Send("ProcessCommand", text.Text)
if text.Text ~= '' and string.len(text.Text) > 1 then
Remote.Send('ProcessCommand', text.Text)
end
closeConsole()
elseif not isInConsoleBounds(player:GetMouse()) then
closeConsole()
end

closeConsole()
end)

text:GetPropertyChangedSignal("Text"):Connect(function()
Expand Down
18 changes: 13 additions & 5 deletions MainModule/Client/UI/Rounded/Console.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,22 @@ return function(data, env)
end
end

local function isInConsoleBounds(pos)
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end

text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
client.Remote.Send('ProcessCommand',text.Text)
if text.Text ~= '' and string.len(text.Text) > 1 then
client.Remote.Send('ProcessCommand', text.Text)
end
close()
elseif not isInConsoleBounds(player:GetMouse()) then
close()
end

close()
end)

text.Changed:Connect(function(c)
Expand Down Expand Up @@ -762,4 +770,4 @@ end]]></ProtectedString>
</Item>
</Item>
</Item>
</roblox>
</roblox>
18 changes: 14 additions & 4 deletions MainModule/Client/UI/Steampunk/Console.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ return function(data, env)
setfenv(1, env)
end

local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local UI = client.UI
local Remote = client.Remote
local Variables = client.Variables
Expand Down Expand Up @@ -226,14 +228,22 @@ return function(data, env)
opened = true
end

local function isInConsoleBounds(pos)
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end

text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if string.len(text.Text) > 1 then
Remote.Send("ProcessCommand", text.Text)
if text.Text ~= '' and string.len(text.Text) > 1 then
Remote.Send('ProcessCommand', text.Text)
end
closeConsole()
elseif not isInConsoleBounds(player:GetMouse()) then
closeConsole()
end

closeConsole()
end)

text:GetPropertyChangedSignal("Text"):Connect(function()
Expand Down
16 changes: 12 additions & 4 deletions MainModule/Client/UI/Windows XP/Console.rbxmx
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,22 @@ return function(data, env)
end
end

local function isInConsoleBounds(pos)
for i,v in ipairs(playergui:GetGuiObjectsAtPosition(pos.X, pos.Y)) do
if v == gui or v == gui.Frame then return true end
end
return false
end

text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
client.Remote.Send('ProcessCommand',text.Text)
if text.Text ~= '' and string.len(text.Text) > 1 then
client.Remote.Send('ProcessCommand', text.Text)
end
close()
elseif not isInConsoleBounds(player:GetMouse()) then
close()
end

close()
end)

text.Changed:Connect(function(c)
Expand Down

0 comments on commit ac20ad8

Please sign in to comment.