Fix Ascension tracker line wrapping
Use tracker wrapping helpers that fall back when Ascension font strings do not expose GetNumLines or GetWrappedWidth. (cherry picked from commit c9b7de2a636ca918c2549a13de87a688861c831f)
This commit is contained in:
@@ -47,6 +47,20 @@ local C_Timer = QuestieCompat.C_Timer
|
|||||||
local GetQuestLogTitle = QuestieCompat.GetQuestLogTitle
|
local GetQuestLogTitle = QuestieCompat.GetQuestLogTitle
|
||||||
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
||||||
local GetItemInfo = QuestieCompat.GetItemInfo
|
local GetItemInfo = QuestieCompat.GetItemInfo
|
||||||
|
local function GetNumLines(label)
|
||||||
|
if label.GetNumLines then
|
||||||
|
return label:GetNumLines()
|
||||||
|
end
|
||||||
|
|
||||||
|
return QuestieCompat.GetNumLines(label)
|
||||||
|
end
|
||||||
|
local function GetWrappedWidth(label)
|
||||||
|
if label.GetWrappedWidth then
|
||||||
|
return label:GetWrappedWidth()
|
||||||
|
end
|
||||||
|
|
||||||
|
return label:GetWidth()
|
||||||
|
end
|
||||||
|
|
||||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||||
|
|
||||||
@@ -1383,16 +1397,16 @@ function QuestieTracker:Update()
|
|||||||
-- Set Blizzard Completion Label and Line widths
|
-- Set Blizzard Completion Label and Line widths
|
||||||
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
||||||
trackerMarginRight)
|
trackerMarginRight)
|
||||||
line:SetWidth(line.label:GetWrappedWidth() + objectiveMarginLeft)
|
line:SetWidth(GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
|
|
||||||
-- Blizzard Completion Text tends to be rather verbose. Allow text wrapping.
|
-- Blizzard Completion Text tends to be rather verbose. Allow text wrapping.
|
||||||
line.label:SetHeight(line.label:GetStringHeight() *
|
line.label:SetHeight(line.label:GetStringHeight() *
|
||||||
line.label:GetNumLines())
|
GetNumLines(line.label))
|
||||||
line:SetHeight(line.label:GetHeight())
|
line:SetHeight(line.label:GetHeight())
|
||||||
|
|
||||||
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
||||||
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
||||||
line.label:GetWrappedWidth() + objectiveMarginLeft)
|
GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update Quest has a check for this edge case. Should reset the Quest Icons and show the Quest Finisher
|
-- Update Quest has a check for this edge case. Should reset the Quest Icons and show the Quest Finisher
|
||||||
@@ -1459,15 +1473,15 @@ function QuestieTracker:Update()
|
|||||||
-- Set Blizzard Completion Label and Line widths
|
-- Set Blizzard Completion Label and Line widths
|
||||||
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
||||||
trackerMarginRight)
|
trackerMarginRight)
|
||||||
line:SetWidth(line.label:GetWrappedWidth() + objectiveMarginLeft)
|
line:SetWidth(GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
|
|
||||||
-- Blizzard Completion Text tends to be rather verbose. Allow text wrapping.
|
-- Blizzard Completion Text tends to be rather verbose. Allow text wrapping.
|
||||||
line.label:SetHeight(line.label:GetStringHeight() * line.label:GetNumLines())
|
line.label:SetHeight(line.label:GetStringHeight() * GetNumLines(line.label))
|
||||||
line:SetHeight(line.label:GetHeight())
|
line:SetHeight(line.label:GetHeight())
|
||||||
|
|
||||||
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
||||||
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
||||||
line.label:GetWrappedWidth() + objectiveMarginLeft)
|
GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Hide the Secondary Quest Item Button. There are some quests with usable items after a quest is completed I
|
-- Hide the Secondary Quest Item Button. There are some quests with usable items after a quest is completed I
|
||||||
@@ -1738,15 +1752,15 @@ function QuestieTracker:Update()
|
|||||||
-- Set Label and Line widths
|
-- Set Label and Line widths
|
||||||
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
line.label:SetWidth(trackerBaseFrame:GetWidth() - objectiveMarginLeft -
|
||||||
trackerMarginRight)
|
trackerMarginRight)
|
||||||
line:SetWidth(line.label:GetWrappedWidth() + objectiveMarginLeft)
|
line:SetWidth(GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
|
|
||||||
-- TextWrap Objective and set height
|
-- TextWrap Objective and set height
|
||||||
line.label:SetHeight(line.label:GetStringHeight() * line.label:GetNumLines())
|
line.label:SetHeight(line.label:GetStringHeight() * GetNumLines(line.label))
|
||||||
line:SetHeight(line.label:GetHeight())
|
line:SetHeight(line.label:GetHeight())
|
||||||
|
|
||||||
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
-- Compare trackerLineWidth, trackerMinLineWidth and the current label, then save the widest width
|
||||||
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
trackerLineWidth = math.max(trackerLineWidth, trackerMinLineWidth,
|
||||||
line.label:GetWrappedWidth() + objectiveMarginLeft)
|
GetWrappedWidth(line.label) + objectiveMarginLeft)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set Objective state
|
-- Set Objective state
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ local l10n = QuestieLoader:ImportModule("l10n")
|
|||||||
local C_Timer = QuestieCompat.C_Timer
|
local C_Timer = QuestieCompat.C_Timer
|
||||||
local C_QuestLog = QuestieCompat.C_QuestLog
|
local C_QuestLog = QuestieCompat.C_QuestLog
|
||||||
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
local GetQuestLogIndexByID = QuestieCompat.GetQuestLogIndexByID
|
||||||
|
local function GetNumLines(label)
|
||||||
|
if label.GetNumLines then
|
||||||
|
return label:GetNumLines()
|
||||||
|
end
|
||||||
|
|
||||||
|
return QuestieCompat.GetNumLines(label)
|
||||||
|
end
|
||||||
|
|
||||||
local LibDropDown = QuestieCompat.LibUIDropDownMenu or LibStub:GetLibrary("LibUIDropDownMenuQuestie-4.0")
|
local LibDropDown = QuestieCompat.LibUIDropDownMenu or LibStub:GetLibrary("LibUIDropDownMenuQuestie-4.0")
|
||||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||||
@@ -751,7 +758,7 @@ function TrackerLinePool.UpdateWrappedLineWidths(trackerLineWidth)
|
|||||||
for _, line in pairs(linePool) do
|
for _, line in pairs(linePool) do
|
||||||
if Questie.db.profile.TrackerWidth == 0 then
|
if Questie.db.profile.TrackerWidth == 0 then
|
||||||
if line.mode == "objective" then
|
if line.mode == "objective" then
|
||||||
if line.label:GetNumLines() > 1 and line:GetHeight() > Questie.db.profile.trackerFontSizeObjective then
|
if GetNumLines(line.label) > 1 and line:GetHeight() > Questie.db.profile.trackerFontSizeObjective then
|
||||||
line.label:SetText(line.label:GetText())
|
line.label:SetText(line.label:GetText())
|
||||||
|
|
||||||
if line.altButton then
|
if line.altButton then
|
||||||
|
|||||||
Reference in New Issue
Block a user