From a15cb01ba83571a877bb2a3c7664039d705ac983 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 1 Jan 2024 18:32:36 -0300 Subject: [PATCH] Fixed a delay on opening Plater Options after opening a Npc Info from 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. --- Plater_DebugFrames.lua | 15 ++++----------- Plater_OptionsPanel.lua | 7 ++++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Plater_DebugFrames.lua b/Plater_DebugFrames.lua index 0a227353..c491ae0f 100644 --- a/Plater_DebugFrames.lua +++ b/Plater_DebugFrames.lua @@ -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() diff --git a/Plater_OptionsPanel.lua b/Plater_OptionsPanel.lua index b03e0862..48cf37d6 100644 --- a/Plater_OptionsPanel.lua +++ b/Plater_OptionsPanel.lua @@ -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) @@ -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"] @@ -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")