Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Console UI unfocusing on click in certain themes #1534

Merged
merged 5 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading