Skip to content

Commit

Permalink
Fix unit tooltip docking for non-startup layouts (FAForever#6216)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaletzTheWise authored May 30, 2024
1 parent b3de37c commit fbdddaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/snippets/fix.6216.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6216) Fix incorrect unit tooltip docking after switching layout in-game (default alt-up/alt-down).
4 changes: 3 additions & 1 deletion lua/ui/game/unitview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local Prefs = import("/lua/user/prefs.lua")
local EnhancementCommon = import("/lua/enhancementcommon.lua")
local options = Prefs.GetFromCurrentProfile('options')
local GetUnitRolloverInfo = import("/lua/keymap/selectedinfo.lua").GetUnitRolloverInfo
local unitViewLayout = import(UIUtil.GetLayoutFilename('unitview'))
local unitViewLayout = nil -- Holds the current layout, updated by SetLayout().
local unitviewDetail = import("/lua/ui/game/unitviewdetail.lua")
local Grid = import("/lua/maui/grid.lua").Grid
local Construction = import("/lua/ui/game/construction.lua")
Expand Down Expand Up @@ -739,12 +739,14 @@ function ShowROBox()
end

function SetLayout(layout)
unitViewLayout = import(UIUtil.GetLayoutFilename('unitview'))
unitViewLayout.SetLayout()
end

function SetupUnitViewLayout(mapGroup, orderControl)
controls.parent = mapGroup
controls.orderPanel = orderControl
unitViewLayout = import(UIUtil.GetLayoutFilename('unitview')) -- SetLayout() will set this too but let's make sure CreateUI() does not use nil, even though it only sets up an OnFrame function.
CreateUI()
SetLayout(UIUtil.currentLayout)
end
Expand Down

0 comments on commit fbdddaa

Please sign in to comment.