@@ -119,12 +119,12 @@ function DialogKey:InitGlowFrame()
119119 self .glowFrame = CreateFrame (" Frame" , nil , UIParent )
120120 self .glowFrame :SetPoint (" CENTER" , 0 , 0 )
121121 self .glowFrame :SetFrameStrata (" TOOLTIP" )
122- self .glowFrame :SetSize (50 ,50 )
122+ self .glowFrame :SetSize (50 , 50 )
123123 self .glowFrame :SetScript (" OnUpdate" , function (...) self :GlowFrameUpdate (... ) end )
124124 self .glowFrame :Hide ()
125125 self .glowFrame .tex = self .glowFrame :CreateTexture ()
126126 self .glowFrame .tex :SetAllPoints ()
127- self .glowFrame .tex :SetColorTexture (1 ,1 , 0 , 0.5 )
127+ self .glowFrame .tex :SetColorTexture (1 , 1 , 0 , 0.5 )
128128end
129129
130130function DialogKey :InitMainProxyFrame ()
@@ -136,7 +136,7 @@ function DialogKey:InitMainProxyFrame()
136136 frame :SetScript (" PreClick" , function ()
137137 if InCombatLockdown () then return end
138138 self :ClearOverrideBindings (frame )
139- local clickButton = frame :GetAttribute (" clickbutton" )
139+ local clickButton = frame :GetAttribute (" clickbutton" ) --[[ @as Button ]]
140140 self :Glow (clickButton )
141141 end )
142142 frame :HookScript (" OnClick" , function ()
@@ -278,12 +278,12 @@ end
278278--- @param popupFrame StaticPopupTemplate # One of the StaticPopup1-4 frames
279279--- @return Frame | nil | false # The button to click, nil if no button should be clicked, false if the text is empty and should be checked again later
280280function DialogKey :GetPopupButton (popupFrame )
281- local fontString = popupFrame .GetTextFontString and popupFrame :GetTextFontString () or popupFrame .text
281+ local fontString = popupFrame .GetTextFontString and popupFrame :GetTextFontString () or popupFrame .text --- @diagnostic disable-line : undefined-field
282282 local text = fontString and fontString :GetText ()
283- local which = popupFrame .which
283+ local which = popupFrame .which --- @diagnostic disable-line : undefined-field
284284
285- local button1 = popupFrame .button1 or popupFrame :GetButton1 ()
286- local button2 = popupFrame .button2 or popupFrame :GetButton2 ()
285+ local button1 = popupFrame .button1 or popupFrame :GetButton1 () --- @diagnostic disable-line : undefined-field
286+ local button2 = popupFrame .button2 or popupFrame :GetButton2 () --- @diagnostic disable-line : undefined-field
287287
288288 -- Some popups have no text when they initially show, and instead get text applied OnUpdate (summons are an example)
289289 -- False is returned in that case, so we know to keep checking OnUpdate
333333function DialogKey :GetFirstVisibleCustomFrame ()
334334 for _ , frameName in ipairs (ns .orderedCustomFrames ) do
335335 local frame = self :GetFrameByName (frameName )
336- if frame and frame :IsVisible () and frame :IsObjectType (' Button' ) and self :GuardDisabled (frame ) then
336+ if frame and frame :IsVisible () and frame :IsObjectType (' Button' ) and self :GuardDisabled (frame ) then --- @diagnostic disable-line : param-type-mismatch
337337 return frame --- @diagnostic disable-line : return-type-mismatch
338338 end
339339 end
@@ -364,17 +364,13 @@ function DialogKey:ShouldIgnoreInput()
364364 local focus = GetCurrentKeyBoardFocus ()
365365 if focus and not (self :GetValidPopupButtons () and (focus :GetName () == " SendMailNameEditBox" or focus :GetName () == " SendMailSubjectEditBox" )) then return true end
366366
367+ -- Ignore input if there's nothing for DialogKey to click
367368 if
368- -- Ignore input if there's nothing for DialogKey to click
369369 not GossipFrame :IsVisible () and not QuestFrame :IsVisible () and not self :GetValidPopupButtons ()
370- -- Ignore input if the Auction House sell frame is not open
371370 and (not AuctionHouseFrame or not AuctionHouseFrame :IsVisible ())
372371 and not self :GetFirstVisibleCraftingOrderFrame ()
373- -- Ignore input if no custom frames are visible
374372 and not self :GetFirstVisibleCustomFrame ()
375- -- Ignore input if no player choice buttons are visible
376373 and not next (self .playerChoiceButtons )
377- -- Ignore input if no spec buttons are visible
378374 and not next (self .specButtons )
379375 then
380376 return true
@@ -395,7 +391,7 @@ function DialogKey:ClearOverrideBindings(owner)
395391 end
396392 if not self .activeOverrideBindings [owner ] then return end
397393 for key in pairs (self .activeOverrideBindings [owner ]) do
398- SetOverrideBinding (owner , true , key , nil )
394+ SetOverrideBinding (owner , true , key , nil ) --- @diagnostic disable-line : param-type-mismatch
399395 end
400396 self .activeOverrideBindings [owner ] = nil
401397end
@@ -414,6 +410,8 @@ function DialogKey:SetOverrideBindings(owner, targetName, keys)
414410 end
415411end
416412
413+ --- @param frame Button
414+ --- @param key string
417415function DialogKey :SetClickbuttonBinding (frame , key )
418416 if InCombatLockdown () then return end
419417 self .frame :SetAttribute (" clickbutton" , frame )
@@ -423,6 +421,7 @@ function DialogKey:SetClickbuttonBinding(frame, key)
423421 RunNextFrame (function () self :ClearOverrideBindings (self .frame ) end )
424422end
425423
424+ --- @param key string
426425function DialogKey :HandleKey (key )
427426 if not InCombatLockdown () then self .frame :SetPropagateKeyboardInput (true ) end
428427 local doAction = (key == self .db .keys [1 ] or key == self .db .keys [2 ])
@@ -467,21 +466,18 @@ function DialogKey:HandleKey(key)
467466 end
468467 end
469468
470- -- Complete Quest
471- if QuestFrameProgressPanel :IsVisible () then
469+ if QuestFrameProgressPanel :IsVisible () then -- Complete Quest
472470 if not QuestFrameCompleteButton :IsEnabled () and self .db .ignoreDisabledButtons then
473471 -- click "Cencel" button when "Complete" is disabled on progress panel
474472 self :SetClickbuttonBinding (QuestFrameGoodbyeButton , key )
475473 else
476474 self :SetClickbuttonBinding (QuestFrameCompleteButton , key )
477475 end
478476 return
479- -- Accept Quest
480- elseif QuestFrameDetailPanel :IsVisible () then
477+ elseif QuestFrameDetailPanel :IsVisible () then -- Accept Quest
481478 self :SetClickbuttonBinding (QuestFrameAcceptButton , key )
482479 return
483- -- Take Quest Reward - using manual API
484- elseif QuestFrameRewardPanel :IsVisible () then
480+ elseif QuestFrameRewardPanel :IsVisible () then -- Take Quest Reward - using manual API
485481 self .frame :SetPropagateKeyboardInput (false )
486482 if self .itemChoice == - 1 and GetNumQuestChoices () > 1 then
487483 QuestChooseRewardError ()
@@ -589,15 +585,15 @@ function DialogKey:EnumerateGossips()
589585
590586 local frames = {}
591587 self .frames = {}
592- if QuestFrameGreetingPanel and QuestFrameGreetingPanel .titleButtonPool then
588+ if QuestFrameGreetingPanel and QuestFrameGreetingPanel .titleButtonPool then --- @diagnostic disable-line : undefined-field
593589 --- @type FramePool<Button , QuestTitleButtonTemplate>
594- local pool = QuestFrameGreetingPanel .titleButtonPool
590+ local pool = QuestFrameGreetingPanel .titleButtonPool --- @diagnostic disable-line : undefined-field
595591 for tab in (pool :EnumerateActive ()) do
596592 if tab :GetObjectType () == " Button" then
597593 table.insert (frames , tab )
598594 end
599595 end
600- elseif QuestFrameGreetingPanel and not QuestFrameGreetingPanel .titleButtonPool then
596+ elseif QuestFrameGreetingPanel and not QuestFrameGreetingPanel .titleButtonPool then --- @diagnostic disable-line : undefined-field
601597 --- @type ScriptRegion[]
602598 local children = { QuestGreetingScrollChildFrame :GetChildren () }
603599 for _ , child in ipairs (children ) do
@@ -609,7 +605,7 @@ function DialogKey:EnumerateGossips()
609605 return
610606 end
611607
612- table.sort (frames , function (a ,b )
608+ table.sort (frames , function (a , b )
613609 if a .GetOrderIndex then
614610 return a :GetOrderIndex () < b :GetOrderIndex ()
615611 else
@@ -641,12 +637,12 @@ end
641637
642638-- Glow Functions --
643639--- @param frame Frame
644- --- @param speedModifier number # increasing this number will speed up the fade out of the glow
645- --- @param forceShow boolean # if true, the glow will be shown regardless of the showGlow setting
640+ --- @param speedModifier number ? # increasing this number will speed up the fade out of the glow
641+ --- @param forceShow boolean ? # if true, the glow will be shown regardless of the showGlow setting
646642function DialogKey :Glow (frame , speedModifier , forceShow )
647643 if self .db .showGlow or forceShow then
648644 self .glowFrame :SetAllPoints (frame )
649- self .glowFrame .tex :SetColorTexture (1 ,1 , 0 , 0.5 )
645+ self .glowFrame .tex :SetColorTexture (1 , 1 , 0 , 0.5 )
650646 self .glowFrame :Show ()
651647 self .glowFrame :SetAlpha (1 )
652648 self .glowFrame .speedModifier = speedModifier or 1
@@ -726,7 +722,7 @@ function DialogKey:GetFrameUnderCursor()
726722 and getFrameName (frame )
727723 and self :GetFrameByName (getFrameName (frame ))
728724 then
729- return frame , getFrameName (frame );
725+ return frame , getFrameName (frame ); --- @diagnostic disable-line : return-type-mismatch
730726 end
731727 end
732728end
0 commit comments