Show SpeechFrame after resetting its position
All checks were successful
forgejo/Czech Quests/addon/pipeline/head This commit looks good

This commit is contained in:
Roman Jaroš 2025-05-04 12:49:59 +02:00
parent 4087c853a1
commit 8e185b368a
2 changed files with 12 additions and 7 deletions

View file

@ -107,6 +107,7 @@ local function InitSpeeches()
CreateButton('Resetovat pozici okna', "RESET", function()
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_X = 0
CzechQuestsAddon_Store.config.SPEECH_FRAME_POSITION_Y = 0
addon.SpeechFrame:Show()
addon.SpeechFrame:UpdateSettings()
end)

View file

@ -8,11 +8,13 @@ local function ShowSpeech(Frame, offsetY)
Frame:ClearAllPoints()
Frame:SetPoint("BOTTOMLEFT", addon.SpeechFrame, "BOTTOMLEFT", 0, offsetY)
Frame:SetHeight(Frame.Message:GetStringHeight() + 10)
Frame:Show()
return Frame
end
local function ReflowMessages(requery)
local offsetY = 0
local waitingForHeights = false
if #messages == 0 then
addon.SpeechFrame:Hide()
@ -23,14 +25,16 @@ local function ReflowMessages(requery)
local Frame = messages[i]
ShowSpeech(Frame, offsetY)
local height = Frame.Message:GetStringHeight()
if height == 0 and not requery then
Frame:Hide()
C_Timer.After(0.5, function()
ReflowMessages(true)
end)
return
if height == 0 then
waitingForHeights = true
end
offsetY = offsetY + Frame:GetHeight() + GAP
offsetY = offsetY + math.max(Frame:GetHeight(), 10) + GAP
end
if waitingForHeights and not requery then
C_Timer.After(0.05, function()
ReflowMessages(true)
end)
end
end