fix(tracker): make the objective marker button usable at larger sizes
The button shared the quest gutter with the collapse button, the quest item buttons and the zone header text, so anything past the default size was clipped by the tracker edge or drawn on top of its neighbours. Give it a gutter of its own instead. GetSuperTrackMarginReserve feeds questMarginLeft, which every layout and width calculation already builds on, and the quest item buttons and zone labels are shifted by the same amount. The button then anchors flush left of the line and the tracker widens to match, so nothing overlaps at any size. Raise the size cap to 70 now that it fits, and drop the hover tooltip. Also stop relying on the SetSuperTrackedQuestID hook as the only source of truth. It never fires while the player is a ghost -- the corpse arrow takes over the marker -- and it has not fired yet on a login or reload, which left the tracker with no idea what was tracked in both cases. The client is now asked directly: the watch frame POI buttons flag their own selection, the map pins say it through their art (the selected variant sits half a texture above the normal one), and the quest log selection answers for the login window when no pin is styled yet. Selection calls are hooked for the same reason, so clicks repaint while dead, and the requests are coalesced because callers select a quest log entry and restore the previous one a line later.
This commit is contained in:
@@ -62,6 +62,29 @@ local function MirrorPinRegion(destination, source, size, pinSize)
|
||||
destination:Show()
|
||||
end
|
||||
|
||||
-- The pin atlases stack the selected (yellow circle, black digits) variant of every cell exactly
|
||||
-- half a texture above the normal one. The client only restyles its pins during the world map's own
|
||||
-- selection pass, which has not run yet right after a login or a reload, so the variant is forced
|
||||
-- here rather than taken on trust from the pin.
|
||||
local function ApplySelectedVariant(texture, selected)
|
||||
local topLeftX, topLeftY, bottomLeftX, bottomLeftY, topRightX, topRightY, bottomRightX, bottomRightY = texture:GetTexCoord()
|
||||
if (not topLeftY) or (not bottomLeftY) or (bottomLeftY - topLeftY) > 0.5 then
|
||||
return
|
||||
end
|
||||
|
||||
local offset
|
||||
if selected and topLeftY >= 0.5 then
|
||||
offset = -0.5
|
||||
elseif (not selected) and bottomLeftY <= 0.5 then
|
||||
offset = 0.5
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
texture:SetTexCoord(topLeftX, topLeftY + offset, bottomLeftX, bottomLeftY + offset,
|
||||
topRightX, topRightY + offset, bottomRightX, bottomRightY + offset)
|
||||
end
|
||||
|
||||
local function GetNumLines(label)
|
||||
if label.GetNumLines then
|
||||
return label:GetNumLines()
|
||||
@@ -81,6 +104,20 @@ local linePool = {}
|
||||
local buttonPool = {}
|
||||
local lineMarginLeft = 10
|
||||
|
||||
-- Gutter given to the supertrack button, which sits flush with the left edge of a quest line. The
|
||||
-- collapse button, the quest item buttons and the labels are all shifted right by this much, so
|
||||
-- nothing lands on top of it and nothing hangs over the tracker's left edge. Fed into
|
||||
-- questMarginLeft, which every width calculation already builds on, so the tracker widens to match.
|
||||
function TrackerLinePool.GetSuperTrackMarginReserve()
|
||||
if (not Questie.db.profile.trackerShowSuperTrackButton) or (not TrackerUtils:IsSuperTrackAvailable()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Reserved even for quests whose button is hidden, so the list does not shift around as quests
|
||||
-- come in and out of the supertrackable set.
|
||||
return (Questie.db.profile.trackerSuperTrackButtonSize or 25) + 4
|
||||
end
|
||||
|
||||
---@param questFrame Frame
|
||||
function TrackerLinePool.Initialize(questFrame)
|
||||
local trackerQuestFrame = questFrame
|
||||
@@ -489,31 +526,33 @@ function TrackerLinePool.Initialize(questFrame)
|
||||
-- texture file has to be copied along with the coordinates: completed quests swap in a
|
||||
-- different file for these slots, and coordinates from one file applied to another
|
||||
-- sample nonsense.
|
||||
local isSuperTracked = TrackerUtils:GetSuperTrackedQuestId() == self.questId
|
||||
|
||||
local pinTexture = pin.GetNormalTexture and pin:GetNormalTexture()
|
||||
if pinTexture then
|
||||
local ownTexture = self:GetNormalTexture()
|
||||
ownTexture:SetTexture(pinTexture:GetTexture())
|
||||
ownTexture:SetTexCoord(pinTexture:GetTexCoord())
|
||||
ApplySelectedVariant(ownTexture, isSuperTracked)
|
||||
end
|
||||
|
||||
local pinSize = pin:GetWidth()
|
||||
MirrorPinRegion(self.number, pin.number, buttonSize, pinSize)
|
||||
MirrorPinRegion(self.turnin, pin.turnin, buttonSize, pinSize)
|
||||
|
||||
-- Sit to the left of whatever already occupies the gutter: the AI_VoiceOver play button
|
||||
-- when that addon is loaded, otherwise the quest collapse button.
|
||||
self:ClearAllPoints()
|
||||
if playButton:IsShown() then
|
||||
self:SetPoint("RIGHT", playButton, "LEFT", -2, 0)
|
||||
elseif line.expandQuest then
|
||||
self:SetPoint("RIGHT", line.expandQuest, "LEFT", -2, 0)
|
||||
else
|
||||
self:SetPoint("RIGHT", line.label, "LEFT", -4, 0)
|
||||
if self.number:IsShown() then
|
||||
ApplySelectedVariant(self.number, isSuperTracked)
|
||||
end
|
||||
|
||||
-- The icon itself already shows the selected variant, copied from the pin above; the
|
||||
-- glow is the one part the pin draws as a separate texture.
|
||||
if TrackerUtils:GetSuperTrackedQuestId() == self.questId then
|
||||
-- Flush with the left edge of the line, in the gutter GetSuperTrackMarginReserve keeps
|
||||
-- clear. Anchored to the top rather than centred on the line so the button stays level
|
||||
-- with the first row of a quest title that wraps, matching the collapse button.
|
||||
local fontSizeQuest = Questie.db.profile.trackerFontSizeQuest
|
||||
self:ClearAllPoints()
|
||||
self:SetPoint("TOPLEFT", line, "TOPLEFT", 0, (buttonSize - fontSizeQuest) / 2 + 1)
|
||||
|
||||
-- The icon carries the selected variant itself; the glow is the one part the pin draws
|
||||
-- as a separate texture.
|
||||
if isSuperTracked then
|
||||
self.glow:Show()
|
||||
else
|
||||
self.glow:Hide()
|
||||
@@ -533,16 +572,6 @@ function TrackerLinePool.Initialize(questFrame)
|
||||
end
|
||||
end)
|
||||
|
||||
superTrackButton:SetScript("OnEnter", function(self)
|
||||
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
|
||||
GameTooltip:SetText(l10n("Point the objective marker at this quest"), 1, 1, 1)
|
||||
GameTooltip:Show()
|
||||
end)
|
||||
|
||||
superTrackButton:SetScript("OnLeave", function()
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
|
||||
superTrackButton:Hide()
|
||||
|
||||
line.superTrackButton = superTrackButton
|
||||
|
||||
Reference in New Issue
Block a user