@@ -175,9 +175,9 @@ function DialogKey:OnPlayerChoiceHide()
175175 self .playerChoiceButtons = {}
176176end
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
207214end
208215
209216--- @return StaticPopupTemplate | nil
210217function 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
217224end
0 commit comments