From 8ea8456d0655117d3178a9cfd10435c09e9ec5b3 Mon Sep 17 00:00:00 2001 From: Paletz Date: Fri, 24 May 2024 20:09:36 +0200 Subject: [PATCH] Fix unit tooltip docking for non-startup layouts by loading the correct unitview layout on layout change. --- lua/ui/game/unitview.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/ui/game/unitview.lua b/lua/ui/game/unitview.lua index 7d4c197efb..d52d53fb65 100644 --- a/lua/ui/game/unitview.lua +++ b/lua/ui/game/unitview.lua @@ -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") @@ -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