Skip to content

Commit

Permalink
Fixed a delay on opening Plater Options after opening a Npc Info from…
Browse files Browse the repository at this point in the history
… MDT

- Was related to the options panel, waiting the lazy load, before opening the tab. The tab for Npc Colors now is created immediately when the options panel is opened.
  • Loading branch information
Tercioo committed Jan 1, 2024
1 parent 7d52562 commit a15cb01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
15 changes: 4 additions & 11 deletions Plater_DebugFrames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,10 @@ end

--due to lazy loading, the panel might not be loaded yet
local npcColorFrame = PlaterOptionsPanelContainerColorManagement
if (not npcColorFrame or not npcColorFrame.Header) then
C_Timer.After(platerInternal.NpcColorsCreationDelay + 0.1, function()
Plater.OpenOptionsPanel(platerInternal.NpcColorsFrameIndex)
npcColorFrame = PlaterOptionsPanelContainerColorManagement
npcColorFrame.AuraSearchTextEntry:SetText(searchString)
npcColorFrame.OnSearchBoxTextChanged()
end)
else
npcColorFrame.AuraSearchTextEntry:SetText(searchString)
npcColorFrame.OnSearchBoxTextChanged()
end
Plater.OpenOptionsPanel(platerInternal.NpcColorsFrameIndex, true)
npcColorFrame.AuraSearchTextEntry:SetText(searchString)
npcColorFrame.OnSearchBoxTextChanged()
--C_Timer.After(0, function() Plater.OpenOptionsPanel(platerInternal.NpcColorsFrameIndex) print("selected tab") end)
end

function platerInternal.InstallMDTHooks()
Expand Down
7 changes: 4 additions & 3 deletions Plater_OptionsPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ local TAB_INDEX_SEARCH = 26
local bIsOptionsPanelFullyLoaded = false

-- ~options �ptions
function Plater.OpenOptionsPanel(pageNumber)
function Plater.OpenOptionsPanel(pageNumber, bIgnoreLazyLoad)
--localization
local L = DF.Language.GetLanguageTable(addonId)

Expand All @@ -165,7 +165,7 @@ function Plater.OpenOptionsPanel(pageNumber)
Plater.CheckOptionsTab()

if (pageNumber) then
if (not bIsOptionsPanelFullyLoaded) then
if (not bIsOptionsPanelFullyLoaded and not bIgnoreLazyLoad) then
C_Timer.After(1.5, function()
---@type df_tabcontainer
local tabContainer = _G["PlaterOptionsPanelContainer"]
Expand Down Expand Up @@ -427,7 +427,8 @@ function Plater.OpenOptionsPanel(pageNumber)
C_Timer.After(0.1, function() Plater.Resources.BuildResourceOptionsTab(resourceFrame) end)
C_Timer.After(0.1, function() Plater.Auras.BuildGhostAurasOptionsTab(ghostAuras) end)
C_Timer.After(platerInternal.CastColorsCreationDelay, function() Plater.CreateCastColorOptionsFrame(castColorsFrame) end)
C_Timer.After(platerInternal.NpcColorsCreationDelay, function() Plater.CreateNpcColorOptionsFrame(npcColorsFrame) end)
--C_Timer.After(platerInternal.NpcColorsCreationDelay, function() Plater.CreateNpcColorOptionsFrame(npcColorsFrame) end)
Plater.CreateNpcColorOptionsFrame(npcColorsFrame)
C_Timer.After(0.1, function() platerInternal.Plugins.CreatePluginsOptionsTab(pluginsFrame) end)

local generalOptionsAnchor = CreateFrame ("frame", "$parentOptionsAnchor", frontPageFrame, BackdropTemplateMixin and "BackdropTemplate")
Expand Down

0 comments on commit a15cb01

Please sign in to comment.