Skip to content

Commit 9dea8a1

Browse files
committed
the gossip frame now properly shows a scrollbar when the text becomes too long. Since it might be risky, there's an option to disable this
1 parent 66f1100 commit 9dea8a1

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

main.lua

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ function DialogKey:OnPlayerChoiceHide()
175175
self.playerChoiceButtons = {}
176176
end
177177

178-
--- @param gossipFrame GossipFrame
179-
function DialogKey:OnGossipFrameUpdate(gossipFrame)
180-
local scrollbox = gossipFrame.GreetingPanel.ScrollBox
178+
--- @param GossipFrame GossipFrame
179+
function DialogKey:OnGossipFrameUpdate(GossipFrame)
180+
local scrollbox = GossipFrame.GreetingPanel.ScrollBox
181181

182182
self.frames = {};
183183
local n = 1
@@ -193,25 +193,32 @@ function DialogKey:OnGossipFrameUpdate(gossipFrame)
193193
end
194194
if tag then
195195
if self.db.numKeysForGossip then
196-
frame:SetText((n % 10) .. ". " .. data.info[tag])
196+
local newText = (n % 10) .. ". " .. data.info[tag]
197+
if self.db.riskyNumKeysForGossip then
198+
data.info[tag] = newText -- this may not be safe, but it looks like the only somewhat reliable way to ensure the scrollbar is enabled when needed
199+
end
200+
frame:SetText(newText)
197201
frame:SetHeight(frame:GetFontString():GetHeight() + 2)
198202
end
199203
self.frames[n] = frame
200204
n = n + 1
201205
end
202206
if n > 10 then break end
203207
end
204-
local oldScale = scrollbox:GetScale()
205-
scrollbox:SetScale(oldScale + 0.002) -- trigger OnSizeChanged
206-
RunNextFrame(function() scrollbox:SetScale(oldScale) end) -- OnSizeChanged only fires if the size actually changed at the end of the frame
208+
--- @type ScrollBoxListLinearViewMixin
209+
local view = scrollbox:GetView()
210+
view:Layout()
211+
if self.db.riskyNumKeysForGossip then
212+
scrollbox:ScrollIncrease() -- force the scrollbar to show if needed
213+
end
207214
end
208215

209216
--- @return StaticPopupTemplate|nil
210217
function DialogKey:GetFirstVisiblePopup()
211218
for i = 1, 4 do
212219
local popup = _G["StaticPopup"..i]
213220
if popup and popup:IsVisible() then
214-
return popup
221+
table.insert(popupFrames, popup)
215222
end
216223
end
217224
end

options.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ns.defaultOptions = {
1616
--- @type table<string, number> # [frameName] = priority
1717
customFrames = {},
1818
numKeysForGossip = true,
19+
riskyNumKeysForGossip = true,
1920
numKeysForQuestRewards = true,
2021
dontClickSummons = true,
2122
dontClickDuels = true,
@@ -241,6 +242,13 @@ function ns:GetOptionsTable()
241242
desc = "Use the number keys (1 -> 0) to select Gossip options or Quests from an NPC dialog window",
242243
descStyle = "inline", width = "full", type = "toggle",
243244
},
245+
riskyNumKeysForGossip = {
246+
order = increment(),
247+
name = wrapName("Number keys for Gossip - Risky"),
248+
disabled = function() return not db.numKeysForGossip end,
249+
desc = "Ensure scrollbar is enabled if the text becomes too long. This may taint objective frame buttons, such as dropping candles in delves. If you encounter issues, just disable this option.",
250+
descStyle = "inline", width = "full", type = "toggle",
251+
},
244252
numKeysForQuestRewards = {
245253
order = increment(),
246254
name = wrapName("Number keys for Quest Rewards"),

0 commit comments

Comments
 (0)