Skip to content
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
19 changes: 14 additions & 5 deletions luaui/Widgets/gui_ecostats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,21 @@ local function updateButtons()
end

if cfgSticktotopbar and WG.topbar ~= nil then
local topbarArea = WG.topbar.GetPosition()
if not topbarShowButtons then
topbarArea[2] = topbarArea[4]
-- Hang under the menu button strip, right-aligned with it. Its widget owns that
-- rect; without it fall back to the top bar, and to the screen top without that.
local buttonsArea = WG.topbar.GetButtonsPosition and WG.topbar.GetButtonsPosition()
local topbarArea = WG.topbar.GetPosition and WG.topbar.GetPosition()
if buttonsArea and topbarShowButtons then
widgetPosX = buttonsArea[3] - widgetWidth
widgetPosY = buttonsArea[2] - widgetHeight
elseif topbarArea then
-- no buttons in the way, so sit right under the bar itself
widgetPosX = topbarArea[3] - widgetWidth
widgetPosY = topbarArea[2] - widgetHeight
elseif buttonsArea then
widgetPosX = buttonsArea[3] - widgetWidth
widgetPosY = buttonsArea[2] - widgetHeight
end
widgetPosX = topbarArea[3] - widgetWidth
widgetPosY = (topbarArea[6] or topbarArea[2]) - widgetHeight
end

if widgetPosX + widgetWidth / 2 > vsx / 2 then
Expand Down
6 changes: 3 additions & 3 deletions luaui/Widgets/gui_options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6955,12 +6955,12 @@
"ui.settings.option.topbar_hidebuttons"
),
type = "bool",
value = (WG.topbar ~= nil and WG.topbar.getAutoHideButtons() or 0),
value = (WG.topbar ~= nil and WG.topbar.getAutoHideButtons ~= nil and WG.topbar.getAutoHideButtons()) or false,

Check failure on line 6958 in luaui/Widgets/gui_options.lua

View workflow job for this annotation

GitHub Actions / stylua

Not formatted

2 line(s) would change. Run stylua 2.5.2 on this file and commit the result.
onload = function(i)
loadWidgetData("Top Bar", "topbar_hidebuttons", { "autoHideButtons" })
loadWidgetData("Top Bar Buttons", "topbar_hidebuttons", { "autoHideButtons" })
end,
onchange = function(i, value)
saveOptionValue("Top Bar", "topbar", "setAutoHideButtons", { "autoHideButtons" }, value)
saveOptionValue("Top Bar Buttons", "topbar", "setAutoHideButtons", { "autoHideButtons" }, value)
end,
},

Expand Down
13 changes: 10 additions & 3 deletions luaui/Widgets/gui_spectator_hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,16 @@ local function calculateWidgetDimensions()
widgetDimensions.left = viewScreenWidth - widgetDimensions.width

widgetDimensions.distanceFromTopBar = mathfloor(defaults.widgetDimensions.distanceFromTopBar * scaleMultiplier)
if WG.topbar and WG.topbar.getShowButtons() then
local topBarPosition = WG.topbar.GetPosition()
widgetDimensions.top = (topBarPosition[6] or topBarPosition[2]) -- widgetDimensions.distanceFromTopBar
-- Sit under whatever occupies the top right corner: the menu button strip when it
-- is shown (its own widget owns that rect), otherwise the top bar, otherwise the
-- screen edge.
local buttonsArea = WG.topbar and WG.topbar.GetButtonsPosition and WG.topbar.GetButtonsPosition()
local topBarPosition = WG.topbar and WG.topbar.GetPosition and WG.topbar.GetPosition()
local buttonsShown = WG.topbar and WG.topbar.getShowButtons and WG.topbar.getShowButtons()
if buttonsArea and buttonsShown then
widgetDimensions.top = buttonsArea[2]
elseif topBarPosition then
widgetDimensions.top = topBarPosition[2]
else
widgetDimensions.top = viewScreenHeight
end
Expand Down
Loading
Loading